Skip to main content

quillmark_content/
lib.rs

1//! `Content`: the canonical content model for Quillmark.
2//!
3//! One [`model::Content`] per content field: a single text sequence carrying
4//! line attributes, anchored marks, and embedded islands, over one coordinate
5//! space of Unicode scalar values. Markdown is a *projection*
6//! ([`import::from_markdown`], [`export::to_markdown`]), so every edit is a
7//! splice and all structure moves with it. [`serial`] is the canonical,
8//! byte-deterministic JSON that storage, the render seam and the binding seam
9//! all carry; [`delta`] and [`ops`] are the per-field edit surface.
10
11pub mod delta;
12pub mod export;
13pub mod import;
14pub mod island;
15pub mod model;
16pub mod normalize;
17pub mod ops;
18pub mod serial;
19pub mod traverse;
20pub mod usv;
21
22/// Maximum container nesting depth the markdown codecs accept before erroring.
23/// The import guard ([`import::from_markdown`]) and the typst backend's markup
24/// converter share this one limit, so a document that imports also renders.
25pub const MAX_NESTING_DEPTH: usize = 100;
26
27/// Maximum nesting depth of an opaque JSON payload (an island's `props`), in
28/// container levels from the bag.
29///
30/// The recursive consumers (key sorting, `serde_json::Value`'s own `Drop`) spend
31/// a frame per level, so an unbounded bag overflows the stack: on wasm32 an
32/// unrecoverable trap, not a catchable error. Matches `serde_json::from_str`'s
33/// own limit, so nothing a stored blob can carry is refused.
34pub const MAX_JSON_DEPTH: usize = 128;