Expand description
Streaming markdown preprocessor that auto-completes incomplete syntax.
Runs on raw markdown strings before the pulldown-cmark parser, detecting and closing unterminated formatting markers so content renders correctly during token-by-token streaming.
Modules§
- priority
- Built-in handler priorities.
Structs§
- Code
Block Ranges - Pre-computed ranges of text that are inside code blocks, inline code spans, or math blocks. Used to skip these regions in emphasis/katex handlers without redundant O(n) scans.
- Stitch
Options - Configuration options for the
stitchfunction.
Enums§
- Link
Mode - How to handle incomplete links.
- Text
Direction - Text direction: left-to-right or right-to-left.
Traits§
- Stitch
Handler - A custom handler that transforms text during the stitch pipeline.
Functions§
- detect_
text_ direction - Detects text direction using the “first strong character” algorithm.
- has_
incomplete_ code_ fence - Returns
trueif the markdown text has an unclosed code fence. - has_
table - Returns
trueif the markdown text contains a table delimiter row. - is_
inside_ code_ block - Returns
trueif the position is inside a fenced code block (between ``` markers) or an inline code span (between`markers). - is_
within_ link_ or_ image_ url - Returns
trueifpositionis inside the URL portion of a link/image](url). - is_
within_ math_ block - Returns
trueifpositionis inside a math block ($or$$). - is_
word_ char - Returns
trueifchis a Unicode letter, digit, or underscore. Matches the TSisWordChar/[\p{L}\p{N}_]. - normalize_
html_ indentation - Strips excessive indentation (4+ spaces/tabs) from lines that start HTML blocks.
- preprocess_
custom_ tags - Preprocesses custom HTML tags to prevent blank lines within them from causing CommonMark to split the block.
- preprocess_
literal_ tag_ content - Escapes markdown metacharacters inside specified HTML tags so their content renders as plain text.
- stitch
- Preprocesses streaming markdown text, auto-completing any incomplete syntax.