Markdown table in a numbered list?

I’ve grown rather accustomed to being able to use numbered lists in my markdown notes in a certain way. In particular, I often use it like the following:

1. Question 1: What is the answer to the ultimate question of life, the universe, and everything?

    Answer: 42.

2. Question 2: What is the ultimate question to which 42 is the answer?

    Answer: Damn those Golgafrinchans!

As long as I indent the subsequent lines, they get “captured” or “included” or whatever the right term is with the numbered list item above. If I don’t indent my answers, or other related text, then they either get their own numbers in the list or terminate the list and restart the numbering with the next item.

Today I did something I haven’t tried before: I had a table indented beneath a numbered list item, and it didn’t get rendered as a table at all; it gets left as plain text. I know the table is correct because it’s rendered nicely if I don’t indent it, but as soon as I do that my list numbering resets, which I don’t want. For sake of illustration, the exact markdown I’m using is as follows:

3. For the Heptapod image, you need to define three different folders because that's what the underlying GitLab requires. Those folders may be described as follows:

    | Purpose | Default GitLab Folder |
    | --- | --- | 
    | Configuration Data | /etc/gitlab |
    | User Content (e.g., database, repositories, etc.) | /var/opt/gitlab |
    | Log Files | /var/log/gitlab |

4. You have to create those three folders within the master docker folder, preferably isolated in their own specific folder for the container in question, and assign the default GitLab folders as their "mount paths" in the advanced options dialog box. The following couple of screen shots should help explain.

It’s taken from a note of mine explaining how to set up Heptapod in a Docker container on a Synology NAS. Can anyone offer advice as to how I could either get the table formatting properly when indented or perhaps prevent the list numbering from resetting if I don’t ident it? Thanks!

I would think that this has nothing to do with DT itself but rather with the syntax of MD.

Presumably, a table can not be part of a list. I’m not sure if that’s possible in HTML. If it’s not, it’s only logical that md imposed the same restriction. Otherwise, it might be a practical limitation of MD.

Edit I found this online, maybe it helps

1 Like

It’s interesting that the amount of space does make a difference, but it appears at no point does the table get formatted as a table. With less than 8 spaces, the text is treated like just another subordinate paragraph and run together. With 8 spaces or more, then it gets treated like pre-formatted text and appears in a fixed-width font and such. I’ll have to see about the inline-HTML.

Aha! I found something that works, though I don’t really understand it. I’m posting it here only for others’ reference. I can fix my problem by putting an empty code block in front of the table as follows:

3. For the Heptapod image, you need to define three different folders because that's what the underlying GitLab requires. Those folders may be described as follows:  

    ```
    ```  
| Purpose | Default GitLab Folder |
| --- | --- | 
| Configuration Data | /etc/gitlab |
| User Content (e.g., database, repositories, etc.) | /var/opt/gitlab |
| Log Files | /var/log/gitlab |
    
  
4. You have to create those three folders within the master docker folder, preferably isolated in their own specific folder for the container in question, and assign the default GitLab folders as their "mount paths" in the advanced options dialog box. The following couple of screen shots should help explain.

I must indent the code block by four spaces and not indent the table, but at least it works. Go figure.

I guess that’s a quirk of MultiMarkdown 6. Generally, the advantage of MD is its simplicity, but that also leads to unclear situations like the one you’re encountering. Markdown has in many cases no end tag which in some situations creates ambiguities. In HTML, a list has to be enclosed in start and end tags. That (and some clear rules) permits to enclose tables in list items. MD forgoes start and end tags for lists, which apparently creates an unclear situation when trying to use a table in a list Item.

Yes, I agree this is not a feature but unexpected behavior. I wouldn’t say I’d rely on this as future releases or updates to MultiMarkdown could change this behavior.

And yet with no other option at the moment, it’s the best I can do. I may have to fix it later.