fix(lists): enforce 4 space indentation in sublists
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);
```
2016-11-11 15:56:29 +08:00
|
|
|
<ul>
|
|
|
|
<li>one</li>
|
|
|
|
</ul>
|
|
|
|
<ol>
|
|
|
|
<li>two</li>
|
|
|
|
</ol>
|
|
|
|
<p>foo</p>
|
|
|
|
<ul>
|
|
|
|
<li>one</li>
|
|
|
|
</ul>
|
|
|
|
<ol>
|
|
|
|
<li>two</li>
|
|
|
|
</ol>
|
|
|
|
<p>foo</p>
|
|
|
|
<ul>
|
|
|
|
<li>one</li>
|
|
|
|
</ul>
|
|
|
|
<ol>
|
|
|
|
<li>two</li>
|
|
|
|
</ol>
|
|
|
|
<p>foo</p>
|
|
|
|
<ul>
|
2016-12-21 07:57:10 +08:00
|
|
|
<li>one<ol>
|
|
|
|
<li>two</li></ol></li>
|
fix(lists): enforce 4 space indentation in sublists
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);
```
2016-11-11 15:56:29 +08:00
|
|
|
</ul>
|
|
|
|
<p>foo</p>
|
|
|
|
<ul>
|
|
|
|
<li>one</li>
|
|
|
|
<li>two</li>
|
|
|
|
</ul>
|
|
|
|
<p>foo</p>
|
|
|
|
<ul>
|
|
|
|
<li>one</li>
|
|
|
|
<li>two</li>
|
|
|
|
</ul>
|
|
|
|
<p>foo</p>
|
|
|
|
<ul>
|
|
|
|
<li>one</li>
|
|
|
|
<li>two</li>
|
|
|
|
</ul>
|
|
|
|
<p>foo</p>
|
|
|
|
<ul>
|
|
|
|
<li>one</li>
|
|
|
|
<li>two</li>
|
|
|
|
</ul>
|
|
|
|
<p>foo</p>
|
|
|
|
<ul>
|
2016-12-21 07:57:10 +08:00
|
|
|
<li>one<ul>
|
|
|
|
<li>two</li></ul></li>
|
fix(lists): enforce 4 space indentation in sublists
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);
```
2016-11-11 15:56:29 +08:00
|
|
|
</ul>
|