Skip to content

Add <video> to block-level HTML tag list (type 6) - #407

Merged
mity merged 1 commit into
mity:masterfrom
hryhoriiK97:add-video-to-block-level-tags
Sep 9, 2026
Merged

mity merged 1 commit into
mity:masterfrom
hryhoriiK97:add-video-to-block-level-tags

Conversation

@hryhoriiK97

@hryhoriiK97 hryhoriiK97 commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The <video> element is widely used in markdown to embed video content but is not currently recognized as a block-level HTML tag. Without type 6 recognition, <video> falls back to type 7, which does not allow any content after the tag on the same line.

Adding video to the type 6 tag list allows <video src="url"></video> to be parsed as an HTML block regardless of what follows the opening tag on the same line — consistent with how other media-related tags like <iframe> and <track> are already handled.

Changes

  • src/md4c.c — Added v6[] array with "video" and updated map6[21] ('v' slot) to point to it.
  • test/spec-video-tag.txt — New test file with 6 examples covering basic recognition, attributes, trailing content, blockquote and list contexts.
  • CHANGELOG.md — Added entry under "Next Version".

test/normalize.py already includes video in is_block_tag() — no change needed.

Reported to the CommonMark spec project: commonmark/commonmark-spec#841.

@codecov

codecov Bot commented Sep 8, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.90%. Comparing base (bed011f) to head (1c81222).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #407   +/-   ##
=======================================
  Coverage   78.90%   78.90%           
=======================================
  Files           5        5           
  Lines        3859     3859           
  Branches     1295     1295           
=======================================
  Hits         3045     3045           
  Misses        299      299           
  Partials      515      515           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mity

mity commented Sep 8, 2026 •

Copy link
Copy Markdown
Owner

Hmmm, sorry, I certainly won't be accepting any changes to the file spec.txt whatsoever. It's copied from upstream at https://github.com/commonmark/commonmark-spec and it's very likely the closest thing to any formal widely recognized Markdown specification document with extensive test suite out there, and I won't willy-nilly create or maintain a fork of it.

Any change proposals, bug reports and pull requests to that file should go there.

That said, we might accept small additions in default behavior as the one in this PR even without changing the specification as a kind of an always-enabled extension, assuming it's small/trivial change without far-reaching syntax modifications, adding an explicit option to enable/disable it would be an overkill, any potential incompatibility is obviously outweighed by its usefulness and unlikely to break anything in the real world, and also assuming it doesn't break any test case the specification does explicitly cover.

For me this PR covers all those checkboxes so we might create a new test file for changes of this kind.

(But even then please report it to the spec project so that next version may cover it and reduce the dialect babel in the long run.)

The <video> element is widely used in markdown to embed video content
but was not recognized as a block-level HTML tag. This caused it to
require type 7 formatting constraints (tag alone on the line with only
trailing whitespace).

Adding it to the type 6 list allows <video src="url"></video> to be
parsed as an HTML block regardless of what follows the opening tag on
the same line, consistent with how other media-related tags like
<iframe> and <track> are handled.

Co-authored-by: Cursor <[email protected]>
@hryhoriiK97

hryhoriiK97 commented Sep 8, 2026 •

Copy link
Copy Markdown
Contributor Author

Hmmm, sorry, I certainly won't be accepting any changes to the file spec.txt whatsoever. It's copied from upstream at https://github.com/commonmark/commonmark-spec and it's very likely the closest thing to any formal widely recognized Markdown specification document with extensive test suite out there, and I won't willy-nilly create or maintain a fork of it.

Any change proposals, bug reports and pull requests to that file should go there.

That said, we might accept small additions in default behavior as the one in this PR even without changing the the specification as a kind of an always-enabled extension, assuming it's small/trivial change without far-reaching syntax modifications, adding an explicit option to enable/disable it would be an overkill, any potential incompatibility is obviously outweighed by its usefulness and unlikely to break anything in the real world, and also assuming it doesn't break any test case the specification does explicitly cover.

For me this PR checks all those checkboxes so we might create a new test file for changes of this kind.

(But even then please report it to the spec project so that next version may cover it covers it and reduce the dialect babel in the long run.)

@mity thanks for the feedback! I've updated the PR:

  • Reverted spec.txt - left it untouched as a CommonMark mirror
  • Moved tests to a new spec-video-tag.txt file, following the pattern of other spec-*.txt extensions

I also opened an issue on commonmark/commonmark-spec to propose adding

@mity
mity merged commit b4033f3 into mity:master Sep 9, 2026
11 checks passed
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.

2 participants