Skip to main content

Crate cindermark

Crate cindermark 

Source
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 Document from source text.
utf16
UTF-8 to UTF-16 offset mapping.

Structs§

CindermarkParser
The main parser object exposed to Swift via UniFFI.
FfiBlock
A block for FFI transport.
FfiDocumentStats
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).
FfiIncrementalResult
Incremental parse result with dirty block range.
FfiIncrementalStyleResult
Lightweight incremental result for the styling-only path. Identical to FfiIncrementalResult but omits stats, avoiding the O(n) grapheme iteration + byte scan that compute_stats performs on every call. Used by the editor’s 400ms restyle timer where stats aren’t needed.
FfiInlineSpan
An inline span for FFI transport.
FfiListItem
A list item for FFI transport.
FfiParseResult
Parse result for FFI transport.
FfiPreviewSpan
A single inline span in a rendered preview.
FfiRenderedPreview
Rendered preview result: plain text with markdown syntax stripped, plus inline span ranges for rich formatting.
FfiSaveParseResult
Combined parse + preview result. Single parse pass produces everything needed for note save: AST, stats, wiki links, headings, and rich previews.

Enums§

FfiBlockType
Block type enum for FFI.
FfiInlineType
Inline type enum for FFI.