Expand description
The rules of a document a person reads and edits through a page:
which version it is, which characters its bytes spell, where its
blocks lie, how much of it one answer carries, what one save
changes, how a suggestion about it is read and decided, and how a
Markdown window reads (crates/documents/Spec.lean).
No I/O: the bytes arrive as slices and leave as values. Reading the disk and the content store, and recording a save, belong to the crates that own those (D1).
Structs§
- Applied
- What applying a transaction left: the new version’s bytes and identity, and the transaction that takes it back.
- Edit
- One replacement: the bytes of
spanin the baseline becomebytes. - Laid
- A stretch of Markdown that was read, and its blocks: what a preview and a reply both answer (D32). An empty stretch has none.
- Lifted
- Bytes lifted out of a version so a window can be cut from them.
- List
Item - One item of a list, with the blocks inside it.
- Offer
- One proposal as the Ledger offered it: who offered it, about which stretch of which version, and the two texts (D13, D18).
- Review
- The card two texts make: their sentences aligned in reading order.
- Row
- One row of a table: one run of inline marks per cell.
- Selection
- Where a selection was begun and where it was carried to, as byte offsets of one version; collapsed when the two are the same offset.
- Slice
- One sentence of a card with the whitespace around it;
lead,textandtrailread in order are the sentence’s bytes (D14). - Span
- A half-open byte interval
[start, end)of one document version. - Text
Edit - One edit as a page sends it: a stretch of the baseline’s bytes, and the text that takes its place (D11).
- Transaction
- Edits against one version, in order, none overlapping another.
- Window
- One stretch of a version, and the characters it spells.
Enums§
- Align
- How a table column is aligned.
- Block
- One block of a window, with the bytes of the version it was read from (D26).
- Check
- Whether an item is a task, and whether it is done.
- Construct
- What a page is shown the source of instead of a drawing (D22, D24).
- Encoding
- The character encoding one document version is read in.
- Format
- The grammar a document’s blocks are read by.
- Inline
- One inline mark. Inline marks carry no span: the readers of today line a preview up with its source block by block (D26).
- Order
- Whether a list counts its items, and from where.
- Preview
- One window of a Markdown version, laid out, or the reason it was not.
- Reading
- What one version’s bytes are to a reader.
- Reply
State - Whether a model’s reply is still arriving (D30).
- Slice
Kind - The role one sentence plays on a card.
- Spacing
- Whether a list’s items are paragraphs apart or one line apart.
Constants§
- ALIGN_
CELLS_ MAX - How many cells the common-subsequence table may hold:
u32each, sixteen MiB in all (D15). Past it the middle of the two lists is one deletion and one insertion: still exact, only coarser. - EXPORT_
BYTES_ MAX - The longest version one export reads: an export’s HTML, about twice its source, still travels as one answer.
- PROPOSAL_
ID_ TAG - What a proposal’s identity digest begins with, so it is never the digest of some document that happens to hold the same bytes (D13).
- WINDOW_
BYTES_ MAX - The most bytes one window carries past the offset it was asked from.
Functions§
- cut
- The window
wantedasks for, cut from bytesliftnamed. - decide
- Decides several cards on one document at once: what their verdicts
accept lands on
sourceas one save, andNonewhen they accept nothing (D17). - export
bytes, a Markdown version inencoding, as one HTML file titledtitle.- head
- The first window of a whole version.
- lift
- The bytes to lift out of a version of
sizebytes to cut the windowwantedasks for: up to [REACH] bytes before it, so a start inside a character can step back to that character, and up to [REACH] after its bounded end, so the end can tell whether a character runs on past it. - preview
- The preview of the window
viewportasks for, cut from bytesliftnamed. - reply
- The blocks of a model’s reply that can no longer change, read by the
grammar a preview is (D30): a settled reply is read as a version
holding exactly its text, one still streaming only up to its closure
point (D31). At most one window, as a preview;
span.endis where the rest of the text is sent from. - save
- Applies a page’s text edits to
source, which must be the versionbaseline, writing each text in that version’s encoding (D11, D12).