Nested list issue when switching to - from markdown
nevf opened this issue · 5 comments
In the Demo If I have:
<ol>
<li>1
<ol>
<li>1.a</li>
</ol>
</li>
<li>2</li>
</ol>
and switch to markdown then back to wysiwyg it looses the nested <ol>
wrapper.
ex.
<ol>
<li>1</li>
<li>1.a</li>
<li>2</li>
</ol>
This is a very strange case, Markdown parsers don't produce this kind of output. What's your use case?
This works just fine:
* a
* b
* c
* d
* e
* f
* g
* h
* i
* j
Seems to be an issue with only ordered lists
, a Markdown input like the following
1. a
2. b
3. c
4. d
5. e
1. f
2. g
3. h
1. i
2. j
or its html counterpart, like
<ol>
<li>a</li>
<li>b</li>
<li>c</li>
<li>d</li>
<li>e
<ol>
<li>f</li>
<li>g</li>
<li>h
<ol>
<li>i</li>
<li>j</li>
</ol>
</li>
</ol>
</li>
</ol>
produces the described erroneous output when parsed into the html or wysiwyg view.
But it seems to be not a problem within woofmark
or megamark
, but within the underlying parser markdown-it
. If you put both lists (the unordered and the ordered) as Markdown into their demo, the unordered list gets parsed correctly, but not so the ordered.
As I hope to avoid at least some work für @bevacqua, I filed an Issue with markdown-it
.
To clear things up: The behaviour I observed is not what the op was talking about (shame on me). Instead, it is in fact another bug.
mardown-it
itself claims to be correct according to them complying with "CommonMark" by only interpreting 4-space indented ordered/numbered lists (while supporting unordered/bullet lists with both, 2- and 4-space indentation), so my Markdown example will not be converted to the desired nested list with only 2-space indention (see link to mentioned issue with markdown-it).
On the other hand, woofmark
will convert a properly nested ordered/numbered list in html/wysiwyg view into a 2-space indented Markdown list when switching to Markdown.
Sorry to hijack this issue, I'll open a new one and clear my answers out of here, if you wish so.
Example
A nested ordered/numbered list (4-space indented):
1. a
1. b
1. c
will be correctly converted to html:
<ol>
<li>a
<ol>
<li>b
<ol>
<li>c</li>
</ol>
</li>
</ol>
</li>
</ol>
which will be converted back to a 2-space indented Markdown:
1. a
1. b
1. c
which will be eventually converted to a flat ordered list in html:
<ol>
<li>a</li>
<li>b</li>
<li>c</li>
</ol>
Please move this issue into domador
or megamark
as appropriate. Closing here.