abcson
abcson

Reputation: 157

Formatting deep lists in markdown

I want to compose a list with the following format:

.1 - Lorem

    .1.1 - Inside Lorem

        .1.1.1 - Inside Inside lorem 

.2 - Lorem

And so on, but 8 whitespaces / 2 tabs are rendered as comments/code blocks, which makes .1.1.1 messy. Is there any way of doing it?

Upvotes: 0

Views: 724

Answers (1)

eskwayrd
eskwayrd

Reputation: 4521

You need to use the standard ordered list syntax at every level, or Markdown processors do not recognize that the indented content represents a list item

So, you markup needs to look like:

1.  Lorem

    1.  Inside Lorem

        1.  Inside Inside lorem

2. Lorem

Then, to get the 1.1 and 1.1.1 numbering, you need to apply CSS to achieve that. See the answer for Can ordered list produce result that looks like 1.1, 1.2, 1.3 (instead of just 1, 2, 3, ...) with css?

If you really need the hyphen between the number and the list item's text, you would also include that in the CSS:

LI:before { content: counters(item, ".") " - "; counter-increment: item }

Upvotes: 2

Related Questions