Namespace md.utils

Source
Expand description

Common utility functions exposed through md.utils for use by plugins.

Variables§

lib

Libraries commonly used by markdown-it and its plugins, re-exported to reduce duplicate dependencies in browser bundles.

Functions§

callable

Wraps a class so it can be called with or without new.

arrayReplaceAt

Returns a copy of a token array with the token at pos replaced by newElements. Used to transform token streams without modifying the original array.

isValidEntityCode

Checks whether a code point can be decoded from a numeric HTML entity.

fromCodePoint

Converts a Unicode code point to a string, like String.fromCodePoint(), but does not throw for invalid input.

unescapeMd

Decodes Markdown backslash escapes.

unescapeAll

Decodes Markdown backslash escapes and HTML character references in link destinations, link titles, and fenced code info strings.

escapeHtml

Escapes HTML special characters in a string.

escapeRE

Escapes regular expression metacharacters in a string.

isSpace

Checks whether a character code is an ASCII space or tab.

isWhiteSpace

Checks whether a character code is whitespace recognized by Markdown.

isPunctChar

Checks whether a character is Unicode punctuation or a symbol.

isPunctCharCode

Checks whether a Unicode code point is punctuation or a symbol.

isMdAsciiPunct

Markdown ASCII punctuation characters.

normalizeReference

Normalizes [reference labels] for case-insensitive lookup.

asciiTrim

"Light" .trim() for blocks (headings, paragraphs), where Unicode spaces should be preserved.