Expand description
oxc-markdown-parser is a CommonMark + GFM (and eventually MDX v3) parser that produces a span-faithful, style-preserving typed AST, designed for building formatters.
Parse behavior targets micromark (= CommonMark + GFM as GitHub renders it). Style facts are first-class AST fields; consumers slice the original source through spans instead of reading cooked values.
§Basic Usage
use oxc_markdown_parser::{Allocator, Parser};
let allocator = Allocator::default();
let parser = Parser::new(&allocator, "# Hello\n");
let ret = parser.parse();
// Markdown mode is structurally diagnostic-free.
assert!(ret.diagnostics.is_empty());Modules§
- ast
- AST node definitions.
- attention
- The delimiter-run rules a printer needs: flanking and pairing, the parser’s own.
- decode
- Backslash-escape and character-reference decoding.
- label
- Link label normalization (CommonMark’s “matches” relation),
micromark’s
normalizeIdentifierequivalence: - lexical
- Lexical predicates: grammar facts for formatters.
- unicode
- Unicode punctuation (general categories P and S), as CommonMark’s flanking rules define it.
Structs§
- Allocator
- A bump-allocated memory arena.
- Constructs
- Which syntax constructs the parser recognizes.
- Diagnostic
- Parser
- Parser
Options - Options for
Parser. - Parser
Return - The outcome of a parse: an AST plus diagnostics.
- Segment
- One logical line of a leaf block:
the source line with container prefixes (
>, list indents) already stripped. - Span
- Span represents a range of a piece of source code. It counts by byte offset, so it’s 0-based.
Enums§
- Diagnostic
Kind - Literal
Kind - The kind of an autolink literal.
Functions§
- escapes_
next - Whether the backslash at
pescapes the next byte (ASCII punctuation only; never a line ending). - literal_
kind - Classifies a matched autolink literal.