commonmark / commonmark/commonmark.js

Type-4 HTML block does not interrupt a paragraph

Open
#223 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1.6k
Forks
231
Avg merge
2d 11h
Merged PRs (30d)
3

Description

Description

<!a> is a type-4 HTML block.

  1. Start condition: line begins with the string <! followed by an ASCII letter.
    End condition: line contains the character >.

--- https://spec.commonmark.org/0.30/#html-blocks

And the same section says:

All types of HTML blocks except type 7 may interrupt a paragraph.

Thus, <!a> is expected to interrupt paragraphs, if I understand correctly.
However, commonmark.js demo emits unexpected output.

Case 1

input:

> foo
<!a>
> bar

expected output:

<blockquote>
<p>foo</p>
</blockquote>
<!a>
<blockquote>
<p>bar</p>
</blockquote>

actual output: (https://spec.commonmark.org/dingus/?text=%3E%20foo%0A%3C!a%3E%0A%3E%20bar)

<blockquote>
<p>foo
&lt;!a&gt;
bar</p>
</blockquote>

Case 2

input:

foo
<!a>
bar

expected output:

<p>foo</p>
<!a>
<p>bar</p>

actual output: (https://spec.commonmark.org/dingus/?text=foo%0A%3C!a%3E%0Abar)

<p>foo
&lt;!a&gt;
bar</p>

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the two Markdown examples from the issue in the commonmark.js demo and compare the actual HTML with the expected output. Trace the parser's handling of type-4 HTML blocks and paragraph interruption; done means both cases emit separate paragraphs or blockquotes with the raw HTML block between them.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.