Text after the end of the nested list is not aligned properly
The following places "more information" as an independent paragraph within the second sub-point, in pandoc
markdown.
1. first item
2. second item
- first subitem
- second subitem
more info about the 2nd item
3. third item
Output:
<ol style="list-style-type: decimal">
<li>first item</li>
<li>second item
<ul>
<li>first subitem</li>
<li><p>second subitem</p>
<p>more info about the 2nd item</p></li>
</ul></li>
<li>third item</li>
</ol>
source to share
This is an annoying problem that I also cannot solve in an elegant way. However, for compiling to HTML, there is a simple solution: place the tag </ul>
or </ol>
after the last element of your nested list.
1. first item
2. second item
- first subitem
- second subitem</ul>
more info about the 2nd item
3. third item
This will cause the HTML to end up in an unordered list before Markdown tells it to. Luckily, this doesn't break your layout at all as long as you mix unordered ( <ul>
) and ordered ( <ol>
) lists. If your nested list is the same type as its parent, this will break your layout *.
If so, you can also place the element <br>
before the first line that no longer belongs to the nested list, which I find to create a more visually appealing layout.
source to share