Package-level declarations

Types

Link copied to clipboard

The interruption variants of the base Markdown flavor.

Link copied to clipboard

Where a block's text ends relative to the last line it consumed.

Link copied to clipboard
class BlockExtent(val lineCount: Int, val endIndex: Int)

How far a block reaches from the line it opened on, with both halves of the decision resolved together so a recognizer cannot pair a line count with the wrong end index.

Link copied to clipboard
class BlockMatch(val token: Token, val lineCount: Int, val scanEnd: Int)

A block produced by a BlockRecognizer.

Link copied to clipboard
fun interface BlockRecognizer

A strategy that attempts to open a block at a line. Recognizers are tried in priority order at every line start, and the first match wins.

Link copied to clipboard
class BlockScanLexer(source: CharSequence, recognizers: List<BlockRecognizer>) : Lexer

A Lexer that scans block-level tokens line by line, trying each recognizer in order at every line start.

Link copied to clipboard

The reasons a line interrupts an open block. Paragraphs, block quotes, footnote definitions, tables and lists each take a variant of this set.

Link copied to clipboard
fun interface InterruptionRule

A single reason a line interrupts an open block.

Link copied to clipboard
object LineRules

The line rules no single block owns: bullets, which lists, list items and setext headings all read, and blankness. Every other opening rule belongs to the recognizer of the block it opens.

Link copied to clipboard

Which ordered bullets count as a list marker.

Link copied to clipboard

The interruption variants of the Quarkdown flavor, which adds multiline math to the base ones.

Functions

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun <T : Any> LineCursor.extendThrough(from: Int = 1, end: BlockEnd = BlockEnd.BEFORE_TERMINATOR, closes: (Line) -> T?): Pair<BlockExtent, T>?

Resolves an extent that grows up to and including the first line closes accepts, which is the shape of every fenced block.

Link copied to clipboard
fun LineCursor.extendToEnd(end: BlockEnd = BlockEnd.BEFORE_TERMINATOR): BlockExtent

Covers every line left, which is where a block that never closes ends.

Link copied to clipboard
fun LineCursor.extendWhile(from: Int = 1, end: BlockEnd = BlockEnd.BEFORE_TERMINATOR, continues: (LineCursor) -> Boolean): BlockExtent

Resolves an extent that grows for as long as continues accepts the line after it. Paragraphs, block quotes, footnote definitions, table rows and blank runs differ only in the predicate and in end.

Link copied to clipboard
fun LineCursor.extent(lineCount: Int = 1, end: BlockEnd = BlockEnd.BEFORE_TERMINATOR): BlockExtent

Resolves an extent of a known amount of lines.

Link copied to clipboard

Builds a match from a resolved BlockExtent.

fun LineCursor.match(lineCount: Int, endIndex: Int, wrap: (TokenData) -> Token): BlockMatch

Builds a match whose token covers the source from the cursor's line up to endIndex. Prefer the BlockExtent overload, which resolves the line count and the end together. This one serves the kinds whose text is not line-aligned: the comment, the page break and the zero-width function call flag.