Skip to main content

Module source

Module source 

Source
Expand description

Colouring markdown source.

The one language this crate can classify without help: it already parses markdown, and a source view needs colour on the platforms crate::highlight cannot reach — tree-sitter is C, and a browser has no libc to build it against.

Spans are painted into a per-byte map rather than pushed as they arrive, because markdown nests — a link inside a heading inside a quote — and the renderer needs them disjoint and in order. Inner events land last and win.

Constants§

LANGUAGES
The fence tags that mean “this is markdown”.

Functions§

is_markdown
Whether a fence tag names markdown.
spans
Colour source as markdown, in bytes and in document order.