All contributions

markedjs/marked

Marked

A fast Markdown parser and compiler to HTML, written in TypeScript and following CommonMark and GitHub Flavored Markdown.

Language
TypeScript
GitHub stars
37,323
Merged changes
1
Project site
marked.js.org

What we changed

The CommonMark type 6 HTML block now accepts a tab after the tag name and a tag at the very end of the input, so such HTML passes through unchanged, as in commonmark.js.

What this work shows

  • The CommonMark 0.31.2 spec
  • Regular expressions in parsers
  • Differential testing against a reference
What was broken

A tab after the tag name broke the HTML block

The type 6 HTML block rule only accepted spaces, a newline, > or /> after the tag name, while CommonMark 0.31.2 also allows a tab and the end of the line. With a tab after <div the paragraph swallowed the opening tag, and a list item written as "- <div" at the very end of the input became &lt;div.

How we fixed it

Tab and end of input in the block rule

We extended the html rule's regular expression with a tab and the end of input. On 67,704 generated documents compared with commonmark.js, 23,063 outputs went from wrong to right and none from right to wrong. Two tests that failed before the change were added.

#4128

Merged change

1 26 October 2026

What it taught us

We check a change to a parser's regular expression on a large set of generated documents, against a reference implementation. Such a test shows not only what the change fixed but also that it broke nothing.

More about this technology: TypeScript, React and Node

Other projects we write code for

Describe your project.

A free quote comes back within an hour during working hours.