Expand description
Cindermark — High-Performance Incremental Markdown Parser
A Rust-native markdown parser designed for real-time editing in native iOS/macOS text editors. Cindermark is the engine that powers the editor in Ember Notes. Features:
- Single-pass lexer + parser producing block + inline AST
- SIMD-accelerated byte scanning via
memchr - UTF-8 to UTF-16 offset mapping for NSTextStorage compatibility
- UniFFI-generated Swift bindings (zero manual C bridging)
- Incremental dirty-region tracking (partial re-parse of edited blocks)
Modules§
- ast
- AST node types for the Cindermark Markdown parser.
- incremental
- Incremental parse: dirty-block detection and partial re-parse.
- inline
- Inline span parser using a delimiter-run algorithm.
- lexer
- SIMD-accelerated UTF-8 byte scanner producing a token stream.
- parser
- Block-level parser producing a
Documentfrom source text. - utf16
- UTF-8 to UTF-16 offset mapping.
Structs§
- Cindermark
Parser - The main parser object exposed to Swift via UniFFI.
- FfiBlock
- A block for FFI transport.
- FfiDocument
Stats - Document-level statistics computed as a byproduct of parsing — zero extra cost. Eliminates ~6 separate Swift string-scanning passes.
- FfiHeading
- A heading extracted from the document (level + text).
- FfiIncremental
Result - Incremental parse result with dirty block range.
- FfiIncremental
Style Result - Lightweight incremental result for the styling-only path.
Identical to
FfiIncrementalResultbut omits stats, avoiding the O(n) grapheme iteration + byte scan thatcompute_statsperforms on every call. Used by the editor’s 400ms restyle timer where stats aren’t needed. - FfiInline
Span - An inline span for FFI transport.
- FfiList
Item - A list item for FFI transport.
- FfiParse
Result - Parse result for FFI transport.
- FfiPreview
Span - A single inline span in a rendered preview.
- FfiRendered
Preview - Rendered preview result: plain text with markdown syntax stripped, plus inline span ranges for rich formatting.
- FfiSave
Parse Result - Combined parse + preview result. Single parse pass produces everything needed for note save: AST, stats, wiki links, headings, and rich previews.
Enums§
- FfiBlock
Type - Block type enum for FFI.
- FfiInline
Type - Inline type enum for FFI.