Skip to main content

Module decode

Module decode 

Source
Expand description

Backslash-escape and character-reference decoding.

The AST carries raw source spans only; this is the shared decoder that turns a raw slice into its cooked text. It is public because a printer needs the very same recognition to judge escape removal safely (an escape whose removal forms an entity changes meaning).

Functions§

decode
Decodes backslash escapes and entities. escapes: false decodes only entities (autolink contents; backslash escapes don’t work there).
destination
The cooked value of a link, image or definition destination (mdast’s url): angle brackets stripped, escapes and entities decoded.
entity
Recognizes a character reference at at (which holds &). Returns the replacement text and the position just past the ;.
html_inline
Inline HTML as micromark’s HTML compiler emits it.
title
The cooked value of a link or definition title held as line pieces: quotes stripped, continuation lines’ leading whitespace removed (micromark strips all of it), escapes and entities decoded.