Expand description
The document model.
A Doc is a flat list of Blocks with an indent level, not a
nested tree. That is Notion’s model rather than CommonMark’s, and it is the
decision the rest of this crate hangs off: editing a flat list means Enter
splits, Backspace merges, and Tab indents — all list operations. On a
nested tree “the previous block” is a traversal and every edit is a
restructure.
The trade is that arbitrarily nested CommonMark does not survive a round
trip: a list inside a quote inside a list flattens. Notion has the same
limitation. What is guaranteed is [crate::serialize]’s fixed point —
parse, serialize, parse again, and the document is unchanged — so an
edit/save cycle never drifts.
Structs§
- Block
- One block, and how deeply it is nested.
- Doc
- A markdown document: blocks in document order.
- Mark
Span - Text
- Inline content: a string, plus marks over byte ranges of it.
Enums§
- Align
- GFM column alignment.
- Block
Kind - The block vocabulary. Closed by design — a consumer that needs a block of its own is a reason to widen this enum rather than to grow an extension system.
- Form
- How a
Mark::Mentionwas written down, which is also how it paints. - Mark
- Part
- Which of a block’s texts a caret sits in.
- Quote
Kind - A GFM alert’s kind — the
[!NOTE]marker a blockquote opens with.