The Markdown renderer turns text such as a model writes into real elements: headings, lists and task lists, quotes, tables, code blocks with a copy button, and links. It parses the text into a tree and draws it with templates, so raw HTML stays text and nothing is ever inserted as HTML.

With streaming, half-written text reads as it will once complete: an open code fence is already a code block, a lone ** waits for its partner, and a caret follows the last word. Blocks that didn’t change keep their DOM.

Links work only for web, mail and phone addresses, and images stay links until you turn on images.

A document

Headings start at headingLevel, so they fit under the page’s own. Wide tables and code scroll in their own regions.

Streaming

The same text, a few characters at a time. Nothing flashes as a symbol, and only the last block re-renders.

Code highlighting

nuiMarkdownCode draws code blocks with a template of yours, here with a tiny highlighter. It gets the code and its language.