Repository navigation
Add <video> to block-level HTML tag list (type 6) - #407
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
|
Hmmm, sorry, I certainly won't be accepting any changes to the file 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]>
550f295 to
1c81222
Compare
@mity thanks for the feedback! I've updated the PR:
I also opened an issue on commonmark/commonmark-spec to propose adding |
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
videoto 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— Addedv6[]array with"video"and updatedmap6[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.pyalready includesvideoinis_block_tag()— no change needed.Reported to the CommonMark spec project: commonmark/commonmark-spec#841.