5

I am trying to create a nested list after an equation in a markdown document in MarkdownPad but instead I am getting a code block. I am unsure how to escape it in order to get nested list (2nd order instead):

Here is the code:

  • 1st order list:
    • 2nd order list:

Some other text here which should be followed by a 2nd order nested list:

- 4 spaces followed by a "-" gives a code block instead of a second order list
Matt
  • 2,289
  • 6
  • 29
  • 45

1 Answers1

4

Short version: you can't.

Since you have inserted a new paragraph (Some other text here which should be followed by a 2nd order nested list:), you have closed the list block. You can't jump straight to a sub-list[^1] without first having an enclosing list[^2].

If, however the some other text is supposed to be an aside regarding the first 2nd order item (and so the following 2nd order item is actually the 2nd 2nd order item of the list), then you can achieve it by not breaking the outer 1st order list:

 - 1st item
     - 2nd item

    other text    
     - also 2nd item

[^1]: i.e. a nested list.

[^2]: This may not be true for all markdown engines, but is the case for the engine used by MarkdownPad. As a side point, the base markdown spec doesn't define a syntax for nested lists.

Oliver Matthews
  • 7,497
  • 3
  • 33
  • 36
  • I know that the html allows this to do via `
      • 2nd order list on its own
    ` - this works even in MarkdownPad. I was searching for a better way to do this with an escape character that wouldn't require me to enclose everything in html tags. I would be interested in knowing whether other markdown engines enable this feature if MarkdownPad doesn't.
    – Matt Feb 24 '14 at 12:59
  • Technically, that's invalid html5 - see http://www.w3.org/html/wg/drafts/html/master/grouping-content.html#the-ul-element only `li`,`script` and `template` tags are valid within `ul` I'm unaware of any markdown implementation that allows skipping straight to nested lists, but It's not something I've ever had cause to look for - conceptually, it makes little sense to nest a list within an empty list. – Oliver Matthews Feb 24 '14 at 13:27
  • Thanks a lot for help. If nobody comes up with an alternative interpretation, I will give this the answer. I agree, my solution is [deprecated](http://stackoverflow.com/questions/5899337/proper-way-to-make-html-nested-list), but especially in note taking such "empty" lists are very useful. – Matt Feb 24 '14 at 22:58
  • @OliverMatthews [`li`](https://www.w3.org/TR/html-markup/li.html#li) may contain [flow contents](https://www.w3.org/TR/html-markup/terminology.html#flow-content), so nested lists are perfectly valid. – Florian Feb 05 '16 at 11:14