-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nested lists render differently in ordered vs. unordered lists #196
Comments
I think this is the answer. With just two spaces nested lists like 1. Echo
- Foxtrott
- Golf
1. Hotel the lists get rendered as <ol>..</ol>
<ul>..</ul>
<ol>..</ol> so NOT nested, hence it looks like the counting has been reset. While lists nested with four spaces like 1. India
- Juliett
- Kilo
1. Lima is rendered correctly as <ol>
<li>Hotel</li>
<li>India
<ul>
<li>Juliett</li>
<li>Kilo</li>
</ul>
</li>
<li>Lima</li>
</ol> |
That is the what confuses me. None of the lists in the example use 4 spaces. With 3 spaces, they consistently render as nested. |
Uh, its three not four in the second block, my bad. If this helps, consider it as more then two :D (I'm not cool enough to know the exact quote of Monty Pythons Holy Handgranade of Antioch) This is the mistune regexp that marks the start of a list: LIST_START = re.compile(
r'( {0,3})([\*\+-]|\d{1,9}[.)])(?:[ \t]*|[ \t][^\n]+)\n+'
) I'm not concerned enough that this causes bigger problems, but I think it would help to add to An Otter Wiki docs that nested lists need 4 spaces. |
I think I figured it out. It depends on the indentation of the first character of the outer list item (the "content"), not the indentation of the list item itself.
|
Hm, maybe sticking to the "official" syntax is the best idea. What do you think? |
From the renderer perspective, the current behavior makes so much bloody sense. But when authoring Wiki pages, the human perspective seems far more relevant. From there, it's just WTF. GitHub are aware that John Grubers spec is ambiguous (GFM Spec, 1.3.1):
The GitHub Flavored Markdown Spec is clear about it (GFM Spec, 5.2, a little above Example 272):
Hence, the same amount of indentation as the first character of the list item content. Example 274 shows a wide list marker The GFM spec seems to be based on the CommonMark spec. The above text passages and examples can be found there as well. So the current mistune behavior regarding sublists seems to follow the CommonMark / GitHub flavor, though I don't know if that is on purpose.
IMHO, list nesting should be configurable, defaulting to I did some more tests with the example snippet above:
So, yeah, neither follows CommonMark. Guess you have free choice. It's a mess. |
Create page with this content:
Observe that all indented lists render as nested, with one exception: 2-space indented within an ordered list
I threw this directly at mistune with the same result, so I suppose it is not specific to Otterwiki.
But it is somewhat surprising to me, as it changes the behavior of the nested list not based on it's indentation but based on what kind of list it is nested within. And it disrupts the counting of the outer ordered list.
Is this worth pointing out somewhere, or maybe even modify the rendering?
Note: The "official" Markdown spec demands 4 spaces for nesting into list items.
Screenshot of Otterwiki:
For comparison, this is rendered by GitHub, same effect:
Nested lists
Hotel
India
Lima
The text was updated successfully, but these errors were encountered: