Skip to content

Definition + setext underline/thematic break, creates loose empty paragraph #262

Closed

Description

@wooorm

I think this is a bug in commonmark.js:

[a]: b
---

[a]: b
===

On the dingus, it yields:

<p></p>
<hr />
<p>===</p>

Rendered here (cmark-gfm + more GH stuff, likely same as just cmark):

<p>---</p>
<p>===</p>

---

===

Activity

  1. jgm commented on Nov 30, 2022

    @jgm
    Member

    One observation: if you change the setext heading line regex to something that will never be matched, the empty p tag disappears. So this is due to some interference with setext heading parsing.

  2. wooorm commented on Nov 30, 2022

    @wooorm
    Author

    Similar to what you note, I think the area around definitions/setext headings/lists is very hard to think about. One example: wooorm/markdown-rs#22 (comment). I have no idea what should happen in these cases. Which comes first? Which construct has precedence, and what happens if it doesn’t match

  3. jgm commented on Nov 30, 2022

    @jgm
    Member

    I remember there were some discussions about this -- you could check the tracker (including closed issues) fro commonmark-spec.

  4. added a commit that references this issue on Oct 13, 2026
  5. added a commit that references this issue on Oct 13, 2026
  6. jgm commented on Oct 13, 2026

    @jgm
    Member

    Fixed by #314.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions