Skip to content

Fix thematic break after a link reference definition - #628

Merged
jgm merged 1 commit into
commonmark:masterfrom
BetterAndBetterII:fix/refdef-thematic-break
Sep 1, 2026
Merged

Fix thematic break after a link reference definition#628
jgm merged 1 commit into
commonmark:masterfrom
BetterAndBetterII:fix/refdef-thematic-break

Conversation

@BetterAndBetterII

Copy link
Copy Markdown
Contributor

A line of dashes immediately after a link reference definition was scanned as a setext underline. After the refdef was consumed, that line never fell through to the thematic-break check, so

[f]:r
---

rendered as <p>---</p> instead of <hr />. Other thematic breaks (***, ___, - - -) already worked because they are not setext underlines.

Only treat a candidate setext underline as a heading when paragraph content remains after resolving reference definitions. Otherwise fall through so --- can still be a thematic break.

Fixes #619

A line of dashes after a refdef was scanned as a setext underline and
never rechecked as a thematic break, so `[f]:r\n---` rendered as
`<p>---</p>` instead of `<hr />`. Only treat the line as a setext
heading when paragraph content remains after resolving refdefs.

Fixes commonmark#619
@jgm
jgm merged commit 6566d91 into commonmark:master Sep 1, 2026
15 checks passed
@jgm

jgm commented Sep 1, 2026

Copy link
Copy Markdown
Member

thanks!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--- after a link reference definition becomes a paragraph instead of a thematic break

2 participants