Skip to content

Thematic breaks don't interrupt paragraphs #41

@llimllib

Description

@llimllib

GFM Spec Reference

Per the GFM spec (§4.1 Thematic breaks):

Thematic breaks can interrupt a paragraph:

Example 28 from spec:

Foo
***
bar

Expected HTML:

<p>Foo</p>
<hr />
<p>bar</p>

Reproduction

Stars, underscores, and spaced variants all fail to interrupt a paragraph:

Foo
***
bar

Foo
___
bar

Foo
* * *
bar

Note: --- works because it's treated as a setext heading underline, not because thematic break interruption is implemented.

Actual Output

The *** is treated as inline emphasis markup (* italic containing empty string, then literal *), and the whole thing becomes one paragraph. Similarly ___ is treated as underscore emphasis, and * * * as alternating italic markers.

Root Cause

handle_in_paragraph() does not check for thematic breaks. It only checks for: blank lines, setext heading underlines, fenced code blocks, and table delimiter rows. The is_horizontal_rule() check only happens in handle_ready_state().

This is the same class of bug as #39 (code fences not interrupting paragraphs).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions