Skip to main content

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 local;
16pub mod model;
17pub mod replica;
18pub mod sections;
19pub mod state;
20pub mod write;
21
22pub use anchor::{Anchor, AnchorKind, AnchorMode, AnchorRole, AnchorState, Coverage};
23pub use model::{Note, Page, PageStatus, Section};
24
25/// The largest section text the splitter produces, in bytes of Markdown. It
26/// leaves room for JSON escaping under [`MAX_DOC_BODY_BYTES`].
27pub const SECTION_MAX_BYTES: usize = 20_000;
28
29/// C0 2.2: the canonical JSON of a doc node's plaintext body is at most this
30/// many bytes, so it still fits a 32 KiB event once sealed.
31pub const MAX_DOC_BODY_BYTES: usize = 24_000;
32
33/// The distance between the `order` of two adjacent sections when a page is
34/// laid out fresh, so an insert between them rarely forces a renumbering.
35pub const ORDER_GAP: u32 = 1024;