mity / md4c

C Markdown parser. Fast. SAX-like interface. Compliant to CommonMark specification.
MIT License
756 stars 138 forks source link

Code span wrongly identified as code block #201

Closed step- closed 5 months ago

step- commented 5 months ago

The following test subject:

start
aaa
```

is incorrectly rendered as a code block after a paragraph (mentioned in https://github.com/mity/md4c/issues/200#issuecomment-1880781719).

According to the spec, the whole subject constitutes a single paragraph that starts with "start" and ends with the second "```".
Below we can see that [cmark](https://github.com/commonmark/cmark) renders the test subject as a single paragraph, stripping white space before lines 2, 3 and 4, which then render as a code span. This is the correct way.

cmark:

p aaa


Below we can see that md2html renders the test subject incorrectly as a code block, and misses some original text, too.

md2html:

p

aaa
```