plusparse/definitions library

Link reference definitions ([label]: url "title") and footnote definitions ([^label]: text), collected across a whole document.

A reference can sit pages away from its definition, and the incremental view parses a document one blank-line-separated segment at a time, so a segment cannot find its definitions by itself. They are collected from the whole source first (MarkdownDefinitions.collect) and handed to every segment's parse.

Classes

MarkdownDefinitions
The link and footnote definitions of one document.
MdLinkDefinition
Where a link reference definition points.

Functions

footnoteDefinitionAt(List<String> lines, int start) → ({String label, List<String> lines, int next})?
A footnote definition starting at line start, or null.
htmlCommentEnd(List<String> lines, int start) → ({int next, String trailing})
Where an HTML comment that opens at line start ends: the line after the one holding --> (or the end of lines when it never closes), and the text after --> on that line.
linkDefinitionAt(String line) → ({MdLinkDefinition definition, String label})?
A link reference definition occupying the whole of line, or null.
normalizeLabel(String label) → String
A label as CommonMark compares it: trimmed, inner whitespace collapsed to one space, and case-folded.
parseLinkTarget(String raw, {bool strict = false}) → ({String? title, String url})?
The destination and optional title inside a link's parentheses (or after a definition's colon).
startsDefinition(String line) → bool
Whether line looks like the start of a link or footnote definition.
unescapeBackslashes(String s) → String
s with every backslash escape of ASCII punctuation replaced by the character it escapes.