Package-level declarations

Types

Link copied to clipboard
data class BlockQuoteStrip(val innerLine: Line)
Link copied to clipboard
data class BulletStrip(val marker: Char, val innerLine: Line, val contentIndent: Int)
Link copied to clipboard
data class Line(val lexemes: List<Lexeme>, val text: String, val lazy: Boolean = false)

A raw line of lexemes with its original text for convenience.

Link copied to clipboard
data class LinkRefDef(val label: String, val destination: String, val title: String?)

A parsed link reference definition.

Link copied to clipboard
typealias LinkRefResolver = (label: String) -> Pair<String, String?>?

Resolves a link reference label to (destination, title?) or null.

Link copied to clipboard
data class ListItemResult(val item: Block.ListItem, val nextIndex: Int, val blankAfter: Boolean, val containsBlank: Boolean)

Result of collecting a list item.

Link copied to clipboard
data class OrderedStrip(val number: Int, val delimiter: Char, val innerLine: Line, val contentIndent: Int)

Properties

Link copied to clipboard

HTML5 named character references. Generated from https://html.spec.whatwg.org/entities.json Keys are entity names WITHOUT leading & and trailing ;.

Functions

Link copied to clipboard
fun parseBlocks(tokens: List<Token>): List<Block>

Block parser: converts a list of block-level Tokens into Block AST nodes.

Link copied to clipboard
fun parseDocument(text: String, gfm: Boolean = true): MarkdownDocument

Parses a markdown string into a MarkdownDocument AST.

Link copied to clipboard
fun parseInlines(text: String, resolveRef: LinkRefResolver? = null): List<Inline>

Parses inline markdown content from raw text into a list of Inline nodes.

Link copied to clipboard
fun parseLines(lines: List<Line>): List<Block>

Parses a list of lines into block AST nodes. This is the main recursive entry point — container blocks call this on their inner content.

Link copied to clipboard

Extracts leading link reference definitions from paragraph text. Returns the list of definitions found plus the remaining text. CommonMark §4.7: [label]: destination "title"

Link copied to clipboard

Tries to strip a block quote marker (> + optional space) from a line.

Link copied to clipboard

Tries to strip a bullet list marker (-, +, *) from a line.

Link copied to clipboard

Tries to strip an ordered list marker (digits + . or )) from a line.