-
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
Nested ordered / unordered list inconsistent behavior #299
Comments
According to the documentation, nested elements must have, at least, 4 spaces indentation. * aaa
1. bbb You can check the demo with your example working |
* aaa
* bbb * aaa
1. bbb But why these two have different behavior? First one currently been parsed to |
You are absolutely right, it's a bug. I will take a look a soon as possible. Regardless, the 3 space indentation rule should apply to both ordered and unordered lists. They should behave exactly the same. |
Nested ul and ol lists behave inconsistently in the requirement of having 3 spaces to be considered a nested list. This fix changes the requirement to only one space in both cases. Closes #299
Acording to the spec, multi paragraph (or block) list item requires subblocks to be indented 4 spaces (or 1 tab). Although, this is mentioned in the documentation, Showdown didn't enforce this rule in sublists because other implementations, such as GFM also didn't. However, in some edge cases, this led to inconsistent behavior, as shown in issue #299. This commit makes 4 space indentation in sublists mandatory. BREAKING CHANGE: syntax for sublists is more restrictive. Before, sublists SHOULD be indented by 4 spaces, but indenting 2 spaces would work. Now, sublists MUST be indented 4 spaces or they won't work. With this input: ```md * one * two * three ``` Before (ouput): ```html <ul> <li>one <ul> <li>two <ul><li>three</li></ul> <li> </ul> </li> <ul> ``` After (output): ```html <ul> <li>one</li> <li>two <ul><li>three</li></ul> </li> </ul> ``` To migrate either fix source md files or activate the option `disableForced4SpacesIndentedSublists` (coming in v1.5.0): ```md showdown.setOption('disableForced4SpacesIndentedSublists', true); ```
should be fixed now in latest development |
@tivie May I ask why it made more sense to be more restrictive to solve the inconsistency, instead of being less restrictive, and allow a minimum of 2 spaces for mixed lists as well? This less restrictive syntax doesn't seem to clash with any other syntax. Many people seem to prefer only 2 spaces, which makes sense because it is simpler. Github also allows indentation with 2 spaces. We are using Showdown in the new WordPress editor, Gutenberg. I tried |
INPUT:
PERFER:
but got:
The text was updated successfully, but these errors were encountered: