Repository navigation
fix: accept newline-delimited HTML block tag names #4240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
hakarrr
wants to merge
37
commits into
markedjs:master
Choose a base branch
from
hakarrr:fix/html-newline-tag-names
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+136
−4
Open
Changes from all commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
9351e96
fix: accept newline-delimited HTML block tag names
hakarrr f0c0845
fix: accept newline-delimited HTML block tag names
hakarrr dbff870
fix: accept newline-delimited HTML block tag names
hakarrr 5eeecd7
fix: accept newline-delimited HTML block tag names
hakarrr f04d8ed
fix: accept newline-delimited HTML block tag names
hakarrr 7f6426f
fix: accept newline-delimited HTML block tag names
hakarrr 209e293
fix: accept newline-delimited HTML block tag names
hakarrr fbcc763
fix: accept newline-delimited HTML block tag names
hakarrr dbca621
fix: accept newline-delimited HTML block tag names
hakarrr d4e2980
fix: recognize HTML block tag names at end of input
hakarrr 364e97e
fix: recognize HTML block tag names at end of input
hakarrr b8041a1
fix: recognize HTML block tag names at end of input
hakarrr 1a16167
fix: recognize HTML block tag names at end of input
hakarrr 1842698
fix: recognize HTML block tag names at end of input
hakarrr 8524096
fix: recognize HTML block tag names at end of input
hakarrr 15ba79e
fix: recognize HTML block tag names at end of input
hakarrr f8046ed
fix: recognize HTML block tag names at end of input
hakarrr f72a7c0
fix: recognize HTML block tag names at end of input
hakarrr c1af983
fix: recognize HTML block tag names at end of input
hakarrr 3863d79
fix: recognize HTML block tag names at end of input
hakarrr b96e37c
fix: recognize HTML block tag names at end of input
hakarrr 913b0b8
fix: recognize HTML block tag names at end of input
hakarrr 43d1c58
fix: recognize HTML block tag names at end of input
hakarrr d0bc5f5
fix: recognize HTML block tag names at end of input
hakarrr cc3c17a
fix: recognize HTML block tag names at end of input
hakarrr 621cc55
fix: recognize HTML block tag names at end of input
hakarrr 4ed9d36
fix: recognize HTML block tag names at end of input
hakarrr 1740196
fix: recognize HTML block tag names at end of input
hakarrr f295cbf
test: remove redundant fixture html_type6_newline_interrupt_commonmar…
hakarrr 4522e07
test: remove redundant fixture html_type6_newline_interrupt_commonmar…
hakarrr 7d9d03a
test: remove redundant fixture html_type6_newline_pedantic_control.html
hakarrr 181c560
test: remove redundant fixture html_type6_newline_pedantic_control.md
hakarrr c096b17
test: add fixture html_type6_eof_interrupt.md
hakarrr fe717a6
test: add fixture html_type6_eof_interrupt.html
hakarrr 5957328
test: fix EOF fixture content html_type6_eof_interrupt.md
hakarrr dea9355
test: remove malformed fixture html_type6_eof_interrupt.html
hakarrr 0f3d22e
test: remove malformed fixture html_type6_eof_interrupt.md
hakarrr File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| <p>a</p> | ||
| <div | ||
| class="x"> | ||
| x | ||
| </div><p>a</p> | ||
| </div | ||
| ><p>a</p> | ||
| <table | ||
| class="x"> | ||
| </table><blockquote> | ||
| <p>a</p> | ||
| </blockquote> | ||
| <div | ||
| class="x"> | ||
| x | ||
| </div><ul> | ||
| <li>a</li> | ||
| </ul> | ||
| <div | ||
| class="x"> | ||
| x | ||
| </div><p>a | ||
| <span | ||
| x></p> | ||
| <p>a | ||
| <x-widget | ||
| x></p> | ||
| <p>a | ||
| <divx | ||
| x></p> | ||
| <p>a</p> | ||
| </div | ||
| x<p>a</p> | ||
| <div | ||
| === | ||
| </div><p>a</p> | ||
| <div |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| --- | ||
| renderExact: true | ||
| gfm: true | ||
| --- | ||
| a | ||
| <div | ||
| class="x"> | ||
| x | ||
| </div> | ||
|
|
||
| a | ||
| </div | ||
| > | ||
|
|
||
| a | ||
| <table | ||
| class="x"> | ||
| </table> | ||
|
|
||
| > a | ||
| <div | ||
| class="x"> | ||
| x | ||
| </div> | ||
|
|
||
| - a | ||
| <div | ||
| class="x"> | ||
| x | ||
| </div> | ||
|
|
||
| a | ||
| <span | ||
| x> | ||
|
|
||
| a | ||
| <x-widget | ||
| x> | ||
|
|
||
| a | ||
| <divx | ||
| x> | ||
|
|
||
| a | ||
| </div | ||
| x | ||
|
|
||
| a | ||
| <div | ||
| === | ||
| </div> | ||
|
|
||
| a | ||
| <div |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| <p>a | ||
| <meta | ||
| x</p> | ||
| <blockquote> | ||
| <p>a</p> | ||
| </blockquote> | ||
| <meta | ||
| x |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| --- | ||
| renderExact: true | ||
| gfm: true | ||
| --- | ||
| a | ||
| <meta | ||
| x | ||
|
|
||
| > a | ||
| <meta | ||
| x |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One case this still misses: the tag name at the very end of the input, with no final newline. The fixture files end with
\n, so the EOF case in the tests is really<div\n.This input never reaches
html(): the paragraph regex swallows the line first, because_htmlInterruptinsrc/rules.tsaccepts[ \t]+,\nor/?>after the tag name, but not end of input. It matters for streaming renderers that re-parse partial text after each chunk.Adding
$there fixes it:On this branch with that change,
npm run test:specs(2043) andtest:unit(256) still pass. In a small matrix (8 tags x 8 contexts, no trailing newline) it fixes 24 cases vs commonmark.js 0.31.2. The only new mismatches area\n<meta, becausemetais still in_tag. That is the same wrong result master already gives fora\n<meta(with a trailing space), and #4239 dropsmetafrom the interrupt list.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for catching this. I reproduced
a\n<divanda\n</divon the original PR head. You are right about the fixture: it ended with a newline, so the EOF coverage claim was too broad.The follow-up handles tag names at true end of input in the modern interruption rule and excludes
metafrom that new EOF path. It preserves all compiled pedantic block rules and leaves the shared list helper unchanged. Eight new exact API assertions use strings with no final newline and fail without the follow-up. I used string assertions because the web editor adds final newlines to fixture files.On the updated head, full
npm testpasses: 2,043 spec tests and 264 unit tests, plus UMD/CJS/types/lint. The 54,600-case tag/delimiter/context comparison has 1,984 changed outputs, all new normalized CommonMark matches; 240,000 generated modern parses have zero match-to-mismatch regressions. Existing META and nested-container gaps remain outside this change. I also corrected the description's EOF claim.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checked 1740196 against commonmark.js 0.31.2:
a\n<div,a\n</div,a\n<table,a\n<p,> a\n<divand- a\n<divwith no final newline now match, anda\n<metastays paragraph text.npm testpasses for me. Thanks. (Upper-case names likea\n<DIV>still stay in the paragraph, but that is the same on master, so not for this PR.)