typelevel / Laika

Site and E-book Generator and Customizable Text Markup Transformer for sbt, Scala and Scala.js
https://typelevel.org/Laika/
Apache License 2.0
410 stars 44 forks source link

Markdown spec compliance: bullet lists do no longer require preceding empty lines #502

Closed jenshalm closed 1 year ago

jenshalm commented 1 year ago

The following test case shows examples of potential enum lists and bullet lists interrupting a paragraph without a preceding empty line (taken from an actual test suite of a classic Markdown parser):

In Markdown 1.0.0 and earlier. Version
8. This line turns into a list item.
Because a hard-wrapped line in the
middle of a paragraph looked like a
list item.

Here's one with a bullet.
* criminey.

Markdown parsers handle the above cases differently. (See here for example output from various parsers)

  1. Some ignore both lists and treat them as belonging to the paragraph.
  2. Some support bullet lists without preceding blank line, but not enum lists.
  3. Some support both list types without preceding blank line

However, all newer parsers marked as CommonMark compliant behave as in 2.

For this reason Laika's Markdown parser changes the behaviour to allow bullet lists without preceding blank lines, while still preventing the same for enum list.

One example file from the test suite taken from a classic Markdown parser which behaves differently had to be adjusted accordingly.

Closes #454