-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
an issue about sublists rendering #367
Comments
It's a bug: - 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9 marked compiler: <ul>
<li>1
<ul>
<li>2
<ul>
<li>3
<ul>
<li>4
<ul>
<li>5
<ul>
<li>6
<ul>
<li>7
<ul>
<li>8
<ul>
<li>8</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul> showdown compiler: <ul>
<li>1
<ul>
<li>2</li>
<li>3
<ul>
<li>4</li>
<li>5
<ul>
<li>6</li>
<li>7
<ul>
<li>8</li>
<li>9</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul> |
Well, the original spec states that, in lists, sub-blocks must be indented 4 spaces (a sub-list is a sub-block). But that was miss implemented in showdown's original version. The rule we used was that sub-lists required 3 spaces indentation. We fixed the bug but created the option Check the demo: |
@tivie I think lots of people are using just 2 spaces for nested lists on GitHub readmes for example. But the problem with this option is that it's not consistent: - ul
- ul - using 2 spaces indents properly
- ul - should use 3 or 4 spaces to indent properly
- ul - should use 4 spaces to indent properly
- ul - again 4 spaces, and so on |
I think there can be just another option, like |
I will have a look and think in a way of making this work with 2 spaces and not break past behavior. |
Meanwhile, check the comparison of implementations |
2 space indentation is quite useful for many people like me |
This issue is quite complex because how other sub blocks behave. For instance, it becomes quite problematic with sublists which have a code sub-block: input - this is indented 1 space
- this is indented 4 spaces
code needs 10 spaces indentation. Why?
- this is indented 5 spaces
code needs 11 spaces indentation. Why?
- this is indented 6 spaces
code needs 12 spaces indentation
- this is indented 7 spaces (why is it level 2)
code needs 13 spaces indentation
- this is indented 8 spaces (why is it still level 2)
code needs 14 spaces indentation
- this is indented 9 spaces (why is it still level 2)
code needs 15 spaces indentation result
As you see, even github gets this wrong. Showdown, on the other hand, always behaves consistently (when That being said, I have a partial fix, but still haven't had the time to properly address all the issues regarding this. |
I would say 2 spaces is becoming the norm, despite was is supported or not. In the wild, there are a lot of projects (if not most, that I see) using 2 space indentation in their editors and markdown files. Another driving need for this is the wide adoption of Prettier in the community. It formatts markdown files too, often normalizing indentation from 3/4 to 2. I would call this a need. Is there anything I can do to help? I would love to flip that |
I founder this bug that prevents lists nested using double spaces from rendering properly. It seems like it's an easy fix: showdownjs/showdown#367
The version I use is
1.6.4
, I setdisableForced4SpacesIndentedSublists
totrue
, and I use '2 spaces' as indentation of sublists, the markdown code isbut the HTML i got is:
In the html above,
xxxx
andcccc
are sibling nodes.So is it a bug or just a misuse ?
The text was updated successfully, but these errors were encountered: