kjdev / hoextdown

Hoextdown is an extension to Hoedown
MIT License
23 stars 15 forks source link

Ordered list where an item contains a code block containing backticks does not render correctly #6

Open jasharpe opened 9 years ago

jasharpe commented 9 years ago

The following list does not render correctly:

1. foo

bar

  1. baz

It renders as two separate ordered lists (so both items are numbered with "1."), rather than as two items in one ordered list, number "1." and "2.".

By contrast, this does render correctly (missing the "````" in the code block):

1. foo

bar


1. baz
gagern commented 4 years ago

The code in list item handling which is responsible for matching code fences does fence matching in a fairly simplistic way. I've written some more about this in https://github.com/kjdev/hoextdown/issues/59 item 4.

I also note that the initial example given here would have different semantics in current Hoextdown and in CommonMark. Hoextdown matches delimiter counts exactly, while CommonMark specifies that the number of symbols in the closing fence may be larger than that in the opening fence. So the latter would read this as one block from ``` to ```` containing bar, and a second block starting at the second ``` and continuing to the end of the list item. I've also mentioned this mismatch in https://github.com/kjdev/hoextdown/issues/59 item 5.