Skip to the content
MdReader

Markdown preview

Put a document in the box and read the rendered page under it. The renderer is Markdig with the GitHub extensions turned on.

Preview

Release notes, 2.3.0

Two fixes and one thing worth reading before you upgrade.

Warning

The --strict flag now fails on warnings it used to print. Run a build before you deploy.

Fixed

  • Timestamps no longer shift by an hour across a DST boundary
  • parse() keeps the original line endings
  • The Windows installer still needs a signature
Component Before After
Parser 180 ms 41 ms
Renderer 95 ms 92 ms
const result = parse(source, { strict: true });
if (!result.ok) throw new Error(result.reason);

Reported by a reader who noticed the hour was wrong.1


  1. Issue 412, reported on a Sunday in October, which is how these things go.↩

What renders

The parser is Markdig, configured with the extensions GitHub turns on and no others:

Syntax highlighting comes from highlight.js and covers its common language set plus PowerShell, Dockerfile, Batch, F#, nginx and Protocol Buffers.

What does not render

Worth knowing before you go looking for a bug:

Where the render happens

On the server, not in your browser. The text goes up as JSON, comes back as HTML, and the page inserts it. Diagrams, math and syntax highlighting are then done in the browser, which is why those three need JavaScript and the rest of the page does not.

A document can be up to two megabytes. Past that the request is refused with a message rather than being cut short. There is also a rate limit of sixty renders a minute per visitor. The editor here debounces to well under that, so you will not meet it by typing.

The heading anchors

Heading ids follow GitHub's rule: lower-case, spaces to hyphens, punctuation dropped, and a numeric suffix when the same text appears twice. A link to #installation in your document should land on the same heading here as it does on the repository page.

Ids that a document supplies itself are kept, except that anything starting with mdr- is renamed. That prefix belongs to the page's own elements, and a document does not get to take one over.

Questions

Which Markdown extensions are on?

CommonMark as implemented by Markdig, plus the extensions GitHub uses: pipe tables, task lists, strikethrough, bare autolinks, footnotes, definition lists, alert blocks, emoji shortcodes, math and Mermaid diagrams. YAML front matter is recognised and hidden.

Can I use raw HTML in the document?

Within limits. The rendered page goes through an allow-list sanitizer, so details, summary, kbd, sup, sub and picture survive, and script, style, iframe, form and every on-event attribute are removed before the page is assembled.

Is there a size limit?

Two megabytes per document. A larger one is refused with a message rather than being cut short.