lean_ctx_doc/lib.rs
1// SPDX-License-Identifier: Apache-2.0
2
3//! The documentation model of lean-ctx.
4//!
5//! A page is a title and an ordered list of sections; notes are addenda that
6//! never touch the body; anchors bind a page to the code it describes, so a
7//! change to that code turns the page stale. Everything here is pure: the
8//! engine reads and writes the replica through its own adapter, and LeanCTX |
9//! Hive replicates the pages as place nodes (`page`, `section`, `note`).
10
11pub mod anchor;
12pub mod emspace;
13pub mod fold;
14pub mod links;
15pub mod model;
16pub mod replica;
17pub mod sections;
18pub mod state;
19pub mod write;
20
21pub use anchor::{Anchor, AnchorKind, AnchorMode, AnchorRole, AnchorState, Coverage};
22pub use model::{Note, Page, PageStatus, Section};
23
24/// The largest section text the splitter produces, in bytes of Markdown. It
25/// leaves room for JSON escaping under [`MAX_DOC_BODY_BYTES`].
26pub const SECTION_MAX_BYTES: usize = 20_000;
27
28/// C0 2.2: the canonical JSON of a doc node's plaintext body is at most this
29/// many bytes, so it still fits a 32 KiB event once sealed.
30pub const MAX_DOC_BODY_BYTES: usize = 24_000;
31
32/// The distance between the `order` of two adjacent sections when a page is
33/// laid out fresh, so an insert between them rarely forces a renumbering.
34pub const ORDER_GAP: u32 = 1024;