Back to Prettier

19350

changelog_unreleased/markdown/19350.md

3.9.01.2 KB
Original Source

Escape unindented indented pseudo setext headers (#19350 by @tats-u)

Indented lines composed of only = or - were previously unindented without being escaped, which caused them to be mistakenly parsed as setext headers. With this change, Prettier now escapes such lines to prevent the misinterpretation:

Check parse results on CommonMark playground

<!-- prettier-ignore -->
markdown
<!-- Input -->
Not a header
    ===
Not a header
    ---
Not a list item or a header
    -

<!-- Prettier stable -->
Not a header
===
Not a header
---
Not a list item or a header -

<!-- Prettier main -->
Not a header
\===
Not a header
\---
Not a list item or a header
\-