Repository navigation
v0.134.0
Upgrade path: 0.133 → 0.134. Every
content value is the content model, and offsets in content values and changes
cross WASM in UTF-16 code units, where they counted scalar values. Python's
revise_body, revise_field and revise_document return a dict receipt,
where they returned a list of Diagnostic, so a loop over the result runs
over its keys: read receipt["warnings"].
Content v2
- feat(content)!: the content model. One value per body or
richtext
field: flat text, blocks and containers with ids, marks, anchors apart from
marks, and islands whose cells and notes are slots of nested content.
Nothing derived is stored: an item's number is computed, and runs are told
apart by container id. The line form moves underquillmark_content::lines
and stays what the renderers and markdown codecs read;migratemoves
values between the two, minting ids deterministically. - feat(content)!: the line form's op lane is removed.
lines::ops
(ChangeBundle,LineOp,MarkOp,IslandOpand their decoders),
Card::apply_body_change,Card::apply_field_change, theNormalized
apply_*methods andEditError::ContentApplygo: aChangethrough
Card::applyis the one edit.quillmark::sessionno longer re-exports
them. The parity corpus's op-wire cell reads theChangedifftakes
from the empty value. - feat(content):
Change, the one way a value is edited. Splice,
setBlock,container,mark,anchor,islandandnestedsteps,
withinvert,compose,map_posand a word-aligneddiff, each a
property-tested law. A change yields a valid value or fails and changes
nothing. - feat(content)!: a block's record rides the
\nthat opens it. A
split names the right half and the left keeps its id, so Enter at the end
of any block, the last included, leaves the text on its id; a join keeps
the left block's id and kind.blocks[0]is the record no splice reaches,
sodiffandreplacekeep the stored first id, andrepairgives the
first piece of a block it splits beside an island the block's record. - feat(content):
gestures::split_blockandjoin_blocksbuild Enter
and Backspace as one splice each, inserting ahead of a block's opening
\nat its start so the text keeps its id. - feat(content):
gestures::inherited_marks(content, at)answers the
marks typed text carries:strong,emph,underlineandstrikegrow
at their end,code,linkand anx-mark at neither edge,
font_familyat both. - feat(bindings)!: every WASM offset is UTF-16. A region's
span,
positionAt's andlocate'spos, a typed revise'sRevised.deltaand
the deltasreattachtakes count in UTF-16 code units, as content values
and changes do; core takes a host's units throughLiveSession::*_in,
Engine::render_in,Revised::delta_inandDocument::reattach_in. - feat(content):
repairmakes a merged state valid. A missing
container leaves a path, a container under two paths takes its first
block's, a later run gets a derived container, an orphan slot or record
goes, text beside a table splits off, and a collapsed range anchor is
dropped. Total and deterministic. - feat(content): repair is how a merged state reads, and a write-back is
optional. Peers holding one merged state compute one value without
writing. Any peer may write back a repair that only deletes or sets; one
that inserts (a block split beside an island, a heading's hard break, a
missing cell) is written back by a single writer, since two peers would
each insert their own.Repair::insertssays which,inserts: trueon
the wire, and a missing cell reportsRepair::EmptyCell. - feat(core)!: storage moves to
quillmark/document@0.134.0, each body
and richtext field the content model. An older row loads migrated, with the
same ids on every load. A value holds each anchor id once over its text
and every slot, so a stored value holding one twice loads keeping its
first holder. - feat(core)!:
Card::apply,reviseandreplacewrite a body or
richtext field and answer aReceipt: the applied change, the new hash,
and the dropped and moved anchors. Each takes the hash its writer read and
refuses a stale one withedit::stale_base.Card::writetakes the
Editeach builds its change from, andwrite_intakes a host's units. - feat(wasm)!:
doc.read,apply,revise,replace,annotatedand
hash(addr), andinvertanddiff, offsets in UTF-16 code units.
Every content payload crossing the binding is the model.overwrite,
reviseContent,applyChangeandmapMarksare removed: callreplace
andapply.compose,rebaseandrepairstay unbound until the
editor or collaboration calls them. - feat(wasm)!: the editing gestures and
mapPos(change, pos, assoc?).
splitBlock,joinBlocks,deleteRange,indent,outdent,wrapand
inheritedMarkstake aContentand answer theChangeto apply, offsets
in UTF-16.mapPoscarries a position across aChange, where it took a
line delta, and answers aMapResult. - feat(python)!: the same surface in snake case, offsets in code points.
- feat(core)!: a content write names its card by
$id. An id no card
holds refuses withedit::unknown_card_id.Document::card_indexand
card_by_idfind a card by id. WASMAddr.cardand Pythoncard=
take a card's$idon every verb, andapply,reviseand
replacetake nothing else, so a card moved or inserted between a read and
its write, its body equal to the one read, no longer takes the write. - feat(content)!: the receipt names every anchor a change loses. An
island a splice deletes, or a slot a props step no longer names, names the
anchors of its slots, each with theislandandslotthat held it.
reviseandreplacename every anchor they lose;applyevery one but
those its ownanchorsteps removed.Applied.droppedand
Receipt.dropped_anchorsarechange::Dropped, anAnchorContextand a
SlotRef; WASM spells itDroppedAnchor. - feat(content)!:
diffrefuses an invalid target.diffandreplace
return theInvariantan invalidafterbreaks, where they returned zero
steps, and reach every valid one step-wise. WASM and Pythondiffanswer
theChange. - feat(content)!: every offset-addressed step can hold to what its writer
read.marksteps and ananchorplacement take an optionalquote,
the text their range covered, and anislandinsert an optionalblock,
the id of the block it lands in; a mismatch isApplyError::Stale, as a
splice'sdeleteis.Applied.appliedandinvertfill both in.
MarkStep::Add,MarkStep::Remove,AnchorStep::Setand
IslandStep::Insertcarry the new fields. - feat(content)!:
map_posanswers aMapResult. A position always
lands, inside deleted text on the deletion'sassocedge and inside an
island a splice deleted on the island's slot, withdeleted,
deleted_before,deleted_afteranddeleted_acrosssaying what went
around it. A splice that deletes an island and names none inremovedis
refused, where it mapped a position inside that island as kept. New
mapping::StepMapandMapping, a list of step maps with mirror links, so
a position a step deleted and its rebased mirror put back maps home. - feat(content)!: reserved
x-names on three vocabularies. A block
kind, mark type or island type spelledx-and more decodes into
BlockKind::Ext,MarkKind::ExtorIslandType::Ext, its attrs or props
held as written, and re-encodes to the same bytes; any other unknown name
still refuses. Validation is structural only. Anx-block reads as a
paragraph, anx-mark formats nothing, and anx-island renders and
exports to markdown as nothing, which the annotated read spells as its
token so a revise keeps it; a content write's revise or replace that
removes one refuses withedit::drops_ext_island, andapplyremoves it.
Steps set and remove them.MarkStep::Remove'stagis aString,
BlockKind::tagandMarkKind::tagreturn&str, andIslandTypeis no
longerCopy. - feat(content):
rebase(base, change, over)moves a change past another
made from the same value, after ProseMirror'srebaseSteps. Each step
maps through the inverse of its change's earlier steps, thenover, then
those steps rebased, and holds to itsdelete,quoteorblockon the
value it now reads; a stepoverdeleted the text of, or whose id is gone,
is arebase::Conflictnaming it. A step by id that would overwrite what
overchanged (a block's kind or path, a container, an island's props)
conflicts rather than undoing it, as does a splice that deletes an island
or blockoverchanged, so a diff'ssetBlocknames only the fields it
changes.
Mapping::map_pointandprojectmap
asapplymoves a point anchor and inside one slot. - feat(core)!: a stale
baserebases the write instead of refusing it.
Each card keeps, in memory only, a log of its recent writes per value: one
snapshot of the value, and each write's normalized change and the hash it
left. A base rebases while the writes since it hold at mostLOG_STEPS
(4096) steps, thousands of keystrokes, and the base the newest write read
whatever its size; past twice that, the oldest writes fold into the
snapshot, so the log holds one copy of the value however large.
apply,reviseandreplacewith a base the log holds rebase over the
changes since, and a revise or replace diffs from the value the base
names. The receipt's newrebasedsays so. A conflict refuses with
edit::rebase_conflict, carryingstepandreason; a base the log does
not reach isedit::stale_baseas before.Card::read_atanswers the
value a base names, andBaseError::Conflictcarriesstepand
reason. - fix(content):
replacemoves an anchor between the prose and a cell,
where it refused withDuplicateId: it carries only an anchor the new
value names nowhere. A props step naming a slot inslotsthat the props
do not name says so, apart from one naming a slot the island holds. - feat(content)!: a block or island keeps its id when a change moves
it. Block and island ids are unique at the end of a change, as anchor
ids are, so a step may insert a copy before another deletes the original;
a step naming an id held twice between steps isApplyError::BadStep.
diffkeeps the id of a block or island moved either way, where it
re-minted one moved toward the front. - perf(content):
applyruns a change in one pass. Each step works on
the blocks it touches, checks only what it touched, and answers its
inverse as it applies; the whole value is validated once, at the end.
invertreads those inverses back, and a receipt lowers the value or
compares anchors only where something was dropped or rewritten. A
4000-step change to 288k characters applies in 26 ms, where it took 96 s,
and inverts in 30 ms, where it took 496 s; a revise of it takes 0.1 s and
a rebase 0.2 s, where they took 294 s and 396 s. An inverse's mark steps
restore each run of marks that differs, not one range over all of them.
tests/speed.rsis the gate, run in CI in a release build. - perf(content): converting a change or value to UTF-16 finds each
offset by binary search, where it walked the text from its start: the
4000-step change crosses each way in about 20 ms, where it took 12 s out
and 19 s in. - perf(core):
content_hashdigests the content value as written,
whose keys are already in order, rather than sorting a copy; the bytes are
the same.
Card identity
- feat(core)!: every composable card carries a
$id. It emits after
$kind, is minted where none is written (cand five base32 letters of a
fixed SHA-256 sequence, so equal markdown parses to equal ids), and a parse
re-mints a malformed or repeated one withparse::card_id_reminted. A
null$id($id:,~) is no$id.
insert_cardrefuses a bad or held id (edit::invalid_card_id,
edit::duplicate_card_id). An older row mints its ids on load.$id
never reaches the plate JSON. - feat(core)!: a whole-document revise pairs cards by
$idfirst. An
incoming card spelling a stored card's id revises it, the most similar of
several spelling one keeps it, and the rest align by text as before. A
revised card keeps its stored id; an inserted one keeps a fresh id or mints
past every stored one. A list field's items align by text, so an item
inserted ahead of an anchored one leaves the anchor on its own item. - feat(core)!: a comment selector names its card.
AnchorSelectorand
DocumentAnchorgaincard_id, andreattachresolves a selector's card by
it wherever the card moved. WASM spells itcardIdonAnchorContext,
DocumentAnchorand theCard/CardInputid; Pythoncard_idand the
card dict'sid.
Two-way annotated read
- feat(content)!: a revise reads the annotated read back. A
qm-anchortag the writer kept pins its anchor's start where it stands,
one it dropped leaves the anchor to the diff, and one naming nothing stored
reportsqm-anchor[ref]. The read marks a tag it moved off its anchor's
startat="span"orat="line", which pins nothing. - feat(content)!: an island markdown cannot spell reads as a
qm-islandtoken,<qm-island ref="ID"></qm-island>, which a revise
keeps as stored: a table's unnamed keys, an equation's unwritable TeX, an
image's extra props. A token naming no stored island reports
qm-island[ref]; a cold import drops every token, reported as
qm-island. ABase::Readmerge compares the sides as annotated reads,
so a token survives it and a moved tag pins through it.
Anchors on every text surface
- feat(content)!: a table cell's and a footnote note's anchors join the
comment contract.Content::anchor_sitesreads every anchor with its
Surface, prose or a cell, andanchor_contexts, the annotated read's
anchorsand everydropped_anchorsreceipt list cell anchors, a cell's
text as itsline.RemoveAnchorremoves an id from every cell, an anchor
Addrefuses an id a cell holds, and an island op refuses a cell anchor
whose id the value already holds (ApplyError::AnchorIdCollision). A revise
keeps a cell's anchor where its island continues and the cell's text is
unchanged.locate_siteandreattachsearch the cells with the prose.
Scoped reads
- feat(core): the annotated read of one address.
Card::body_annotated
andfield_annotated(WASMdoc.annotatedAt(addr)) read one body or
richtext field as the revise at that address reads it back, and as its
baseMarkdown.
Guarded revise
- feat(core)!: a revise states what its writer read.
Base::Hashis the
hash of the value read (Card::body_hash,Card::field_hash,
Document::hash,content_hash, and the typed writer'shash/
field_hashthrough the schema: SHA-256 overquillmark/hash@1and the
key-sorted canonical JSON), and a value that now hashes otherwise refuses
the write withedit::stale_base.Base::Readis the markdown read, annotated or not:
when the value has changed since, the writer's edit and the change merge by
line (quillmark_content::delta::merge_lines), so a person's edit made
between an LLM's read and its write lands beside the LLM's, and runs of
lines both changed refuse withedit::rebase_conflict. Both carrycurrent,
the hash now. The verbs arerevise_body_against,revise_field_against,
the writers'revise_document_against, and the free
revise_import_against.EditErrorgainsBase(BaseError)and
BoundParseErrorgainsBase. - feat(wasm):
BaseOptionson every revise. The writer'sreviseBody/
reviseField/reviseDocumenttake an optional
{ baseHash?, baseMarkdown? }, read through the writer'shash()/
hashAt(addr)or the quill-freedoc.hashAt(addr)/doc.hash(). - feat(python):
base_hashandbase_markdownon the writer's revise
verbs, read through the writer'shash()/hash_at(field=None, card=None)and the quill-freedoc.hash_at/doc.hash().
Markdown export
- feat(content): an export can name what it does not spell.
export::to_markdown_checkedreturnsExported { markdown, losses }, the
markdown read back and compared with the content: eachExportLossis a
mark written over other text or dropped, an island that reads back
otherwise, orTextwhere the text or its blocks do. Core mints one
export::lost_constructwarning per loss (lost_construct), its
constructthe mark's wire type, the island's type ortext, a mark's
startandendbeside it. - fix(content): a
*,_or~~mark over edge whitespace keeps its
text.barin bold wrote no bold at all, its delimiter never closing
against a space; it now writes**bar**, the mark overbar. - perf(content):
to_markdownreads each line's marks alone, so export is
linear in the marks where it scanned every mark per line. - feat(content)!: a markdown import reports the bidi controls it drops,
underparse::dropped_constructwithconstruct: "bidi".Droppedgains
Bidi.
Comments
- feat(content): anchor contexts and exact re-attachment. The
anchor
module reads each prose anchor's quote, prefix and suffix off the stored
text as it is, an inline island'sU+FFFCslot included
(anchor_contexts), finds the one range a context names (locate), and
re-adds a dropped anchor through theAddarm (Content::reattach), a range
over exactly its quote and a point at the one place its context meets. The
rule never guesses: a quote ofMIN_ANCHOR_QUOTE(four) scalar values or
more, or island slots alone, its context agreeing onANCHOR_AGREE_USV
(eight) each side or as far as it reaches where the field's edge cut it, a match overlapping inserted text where a
delta is given, and exactly one such place.Delta::inserted_spansis
public. (#2349) - feat(core):
Document::reattachandRevised.dropped_anchors.
Document::anchor_contexts/anchor_context(id)read each anchor's
AnchorSelector { id, path, quote, prefix, suffix }, and
Document::reattach(selectors, deltas)places dropped anchors at their
paths, path-strict, an id live anywhere in the document, a cell's included,
answered without a write.Revisedgainsdropped_anchors, each
AnchorRead { id, line }, at every rung that revises one body or field, and
revise_importtakes the&Normalizedit names them from. The facade
re-exportsAnchorSelector,Reattached,AnchorReadandDocPath.
(#2349) - feat(wasm):
anchorContexts,anchorContext,reattachand
droppedAnchors. The selector crosses flat, itspathaDocPath
string;reattach(selectors, deltas?)takes aRecord<path, Delta>and
returns{ reattached, orphaned }. TheRevisedreceipt of
writer.reviseBodyandwriter.reviseFieldgains
droppedAnchors: { id, line }[]. (#2349) - feat(python)!: the revise verbs return the whole receipt.
writer.revise_body/revise_fieldreturn{ delta, warnings, dropped_anchors }andrevise_document{ dropped_anchors, warnings, from },
its warnings the sameDiagnosticobjects, where each returned a list of
them.doc.anchor_contexts(),doc.anchor_context(id)and
doc.reattach(selectors, deltas=None)expose the handle. (#2349) - docs(canon):
COMMENTS.mdstates the comment-anchor contract: the
thread outside the document, the id it shares with its anchor, the matching
rule, drift, table cells, and the hosting rule. (#2349)
Removed
- refactor(wasm)!: WASM API no consumer uses.
Document.revise(the
0.133 markdown revise;reviseis now the content-lane write),
rebase,loadStored,storeFields,Quill.seedMain,
Document.markdownRules,assignInstances,CardReaderand
reader.card(i),CardWriter.index/kind, the writer's and reader's
documentgetters andLiveSession.backendIdare removed. The migration
guide's § Removed names each replacement. - refactor(core,pdf)!: public items nothing outside their crate uses.
BUNDLE_MEDIA_TYPEis removed;QuillConfig::is_snake_case_identifier,
quillmark_pdf::CHECK_GLYPHandFieldSpec::assert_finite_rectare
crate-private;SessionHandle::updatehas no default, and the
backend::update_unsupportedcode no built-in backend raised is gone. - refactor(content)!:
serial::line_kind_to_valueis removed, and
serial::line_kind_from_value,container_from_valueand
mark_from_valueare crate-private: decode a whole value through
lines::serial::from_canonical_value.
Dependencies
- build(deps):
serde-saphyr2.0, with the YAML error sanitizer
stripping its new API names from messages; Typst'shayro0.7 for the
PDF form backend's raster;pyo30.30.1 andlopdf0.46. - ci(release): PyPI publishes only where
PUBLISH_PYPIis set.