Skip to content

fix: allow a tab or end of input after a type 6 html block tag name - #4128

Merged
UziTech merged 1 commit into
markedjs:masterfrom
dualfroz:fix/html-block-type6-tab
Oct 26, 2026
Merged

UziTech merged 1 commit into
markedjs:masterfrom
dualfroz:fix/html-block-type6-tab

Conversation

@dualfroz

@dualfroz dualfroz commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Marked version: 18.1.0 (master, 7e8754d)

Markdown flavor: CommonMark|GitHub Flavored Markdown

Description

  • no issue. the type 6 html block start (src/rules.ts line 165) only accepts spaces, a newline, > or /> after the tag name. commonmark 0.31.2 also allows a tab and the end of the line, which includes the end of the input.

Expectation

<div\tclass="x">\n*stays raw*\n</div> (\t = tab) passes through unchanged, as in commonmark.js 0.31.2. same for <div as the last line of the input, a list item or a block quote.

Result

<p><div\tclass="x">\n<em>stays raw</em></p>\n</div>: the paragraph swallows the opening tag and </div> ends up outside it. - <div\n- b gives <li>&lt;div</li>.

What was attempted

(?: +|\n|/?>) -> (?:[ \t]+|\n|/?>|$), html rule only. the paragraph interrupt and htmlBeginRegex have the same gap, but #4124 edits those lines, so they are left for a follow-up.

67,704 generated documents (gfm: false, vs commonmark.js 0.31.2, whitespace ignored): 26,455 outputs change, 23,063 wrong -> right, 0 right -> wrong. the other 3,392 are wrong before and after, all list items and block quotes ending on such a line (the gap above). recheck: block.normal.html and block.gfm.html safe. spec completion unchanged.

Contributor

  • Test(s) exist to ensure functionality and minimize regression (if no tests added, list tests covering this PR); or,
    • html_block_tab_after_tag_name and html_block_tag_at_end_of_input, both fail on master; each half of the change alone leaves one red.
  • no tests required for this PR.
  • If submitting new feature, it has been documented in the appropriate places.

Committer

In most cases, this should be a different person than the contributor.

the type 6 html block start only accepted spaces, a newline, > or /> after the tag name. commonmark 0.31.2 also allows a tab and the end of the line, which includes the end of the input.
@vercel

vercel Bot commented Oct 7, 2026

Copy link
Copy Markdown

@dualfroz is attempting to deploy a commit to the MarkedJS Team on Vercel.

A member of the Team first needs to authorize it.

@vercel

vercel Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
marked-website Ready Ready Preview Oct 8, 2026 2:41pm UTC

Request Review

@UziTech UziTech left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch!

@UziTech
UziTech merged commit e09c40d into markedjs:master Oct 26, 2026
8 checks passed
github-actions Bot pushed a commit that referenced this pull request Oct 26, 2026
## [18.1.2](v18.1.1...v18.1.2) (2026-10-26)

### Bug Fixes

* allow a tab or end of input after a type 6 html block tag name ([#4128](#4128)) ([e09c40d](e09c40d))
* apply emphasis flanking and rules 9-10 to the whole delimiter run ([#4145](#4145)) ([5d8e234](5d8e234))
* **cli:** await config functions before parsing ([#4138](#4138)) ([3a11ad1](3a11ad1))
* **cli:** create no-clobber output files atomically ([#4135](#4135)) ([e7c4f64](e7c4f64))
* do not continue a block quote paragraph from a whitespace-only line ([#4134](#4134)) ([42f34a8](42f34a8))
* expand a tab after the block quote marker to the next tab stop ([#4110](#4110)) ([2d3899b](2d3899b))
* honor per-call async options when composing hooks ([#4139](#4139)) ([379be9d](379be9d))
* keep a line starting with # but no space in the list item ([#4127](#4127)) ([6b63189](6b63189))
* keep duplicate link definitions in the tokens ([#4132](#4132)) ([2784acc](2784acc))
* keep lazy lines after a list in a nested blockquote ([#4137](#4137)) ([38c7e55](38c7e55))
* keep lazy setext underlines in list items as text ([#4126](#4126)) ([398234c](398234c))
* render nested image alt formatting as plain text ([#4131](#4131)) ([15f59bb](15f59bb))
* stop an unclosed inline raw tag from unescaping later blocks ([#4130](#4130)) ([4562b6f](4562b6f))

### Performance Improvements

* ~16% faster parsing by skipping em/strong masking for runs without *, _ or ~ ([#4142](#4142)) ([f0fd3e0](f0fd3e0))

This branch was successfully deployed

1 active deployment
Preview — c8795a47 Deployed Oct 8, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants