Expand description
rsmarkdown-core — streaming markdown core.
Pipeline (mirrors jinghaihan/vue-stream-markdown’s markmend package):
raw content
-> normalize (CRLF, trailing whitespace, LaTeX pre-processing)
-> parse_markdown_into_blocks (streaming mode; single block in static mode)
-> preprocess LAST block only (syntax self-healing: code/strong/emphasis/delete/
task-list/link/table/inline-math/math/html/footnote)
-> parse each block to AST (LRU-cached, only the tail block is new)
-> Renderer trait (display adapters implement this)The core crate has zero terminal/display dependencies.
Re-exports§
pub use ast::Alignment;pub use ast::Ast;pub use ast::Block;pub use ast::Inline;pub use ast::ListItem;pub use preprocess::PreprocessOptions;pub use processor::BlockResult;pub use processor::CacheStats;pub use processor::Document;pub use processor::MarkdownProcessor;pub use processor::Mode;pub use processor::ProcessorOptions;pub use renderer::NullRenderer;pub use renderer::Renderer;
Modules§
- ast
- Renderer-facing AST. Produced per block by
parse::parse_block; consumed by display adapters. Deliberately small and stable — this is the core/display seam. - blocks
- Block segmentation, ported from
markmend/core/src/preprocess/vendored/parse-blocks.ts(itself ported from vercel/streamdown). Splits markdown into stable blocks so only the trailing block needs re-parsing as content streams in. - fix
- Streaming preprocessors (“fix” functions), ported one-to-one from
markmend/core/src/preprocess/*.ts. Each one makes incomplete markdown syntax parseable as it streams, so the AST stays stable. - parse
- Markdown string -> AST conversion on top of pulldown-cmark.
This is the Rust counterpart of
mdast-util-from-markdownused by the original. - pattern
- Shared line patterns (ported from
pattern.ts) as small predicates/helpers. - preprocess
normalize+preprocesspipeline, ported frommarkmend/core/src/preprocess/index.tsandvendored/markdown-utils.ts.- processor
MarkdownProcessor— the streaming core. Ported frommarkmend/core/src/processor.ts+markmend/astcache behavior:- renderer
- The core/display seam. Display adapters (TUI, web, etc.) implement
Renderer; the core never depends on any display library. - scan
- Byte-level scanning helpers ported from
markmend/core/src/preprocess/utils.tsandpattern.ts. All positions are byte offsets into the original string.