Expand description
Markup document domain codec for SIM.
Provides codec:doc, a domain decoder/encoder pair that turns document text
into a semantic markup document Expr and back, strict
codec:markup/<id> backends for Markdown, Typst, AsciiDoc, and LaTeX, and
provenance-preserving chunk operations exposed as callable functions.
As a domain codec it round-trips only documents and chunks and fails closed
outside that domain.
Module map (all modules are private; the public surface is re-exported from this crate root):
- backend: the
MarkupBackendtrait, deterministicBackendRegistry, and fidelity/error contracts for backend implementations. - catalog: the implemented/tracked backend catalog for markup formats.
- codec: the
DocCodecdecoder/encoder, theDocCodecLibhost lib, andinstall_doc_codecpluscodec:markup/<id>installation. - document: compatibility chunking wrappers (
DocValue,DocFormat,DocBlock,DocChunk,ChunkOp),decode_document, andchunk. - edit: reversible document-domain edits over
MarkupDoc. - markup: the shared semantic markup IR (
MarkupDoc,MarkupBlock,Inline) and its ordinary-data projection. - functions: the
doc/chunk-*chunking functions registered as callables. - asciidoc: the
asciidork-parserAsciiDoc backend. - latex: the
codebook-tree-sitter-latexLaTeX backend. - markdown: the
pulldown-cmarkMarkdown backend. - typst_backend: the
typst-syntaxTypst backend.
Structs§
- Ascii
DocBackend - Safe AsciiDoc markup backend.
- Backend
Id - A backend identifier such as
markdown,typst,asciidoc, orlatex. - Backend
Info - Catalog row describing one markup backend or tracked format.
- Backend
Registry - Deterministic registry of markup backends.
- Basic
Markdown Backend - Compatibility name for the default Markdown backend.
- DocBlock
- One parsed span of a document, carrying its byte offsets and the heading path in effect where it appears.
- DocChunk
- A provenance-preserving slice of a document produced by
chunk. - DocCodec
- The
codec:docdecoder/encoder. - DocCodec
Lib - The host-registered
Libthat installsDocCodecascodec:docand thedoc/chunk-*chunking functions. - DocValue
- A decoded document: its full source text, detected format, and the ordered
DocBlocks parsed from it. - Latex
Backend - Safe LaTeX article-subset backend.
- Markdown
Backend - CommonMark/GFM-compatible Markdown backend.
- Markup
Codec - Strict runtime codec for one markup backend.
- Markup
Decode Options - Decode options shared by markup backends.
- Markup
Doc - A semantic markup document independent of its concrete source backend.
- Markup
Encode Options - Encode options shared by markup backends.
- Markup
Fidelity - Fidelity report returned by markup backends.
- Markup
Loss - A single lossy conversion note.
- Math
Source - Markup math source with a notation label.
- Source
Doc - A concrete source document preserved alongside the semantic IR.
- Span
- A source span in byte offsets.
- Typst
Backend - Safe Typst markup backend.
Enums§
- Backend
Status - Implementation state for a cataloged markup backend.
- ChunkOp
- A chunking strategy selecting how
chunksplits aDocValue. - DocBlock
Kind - The category of a
DocBlock. - DocFormat
- The detected surface format of a decoded document.
- Inline
- Inline content in a markup document.
- Markup
Block - A semantic block in a markup document.
- Markup
Edit - A reversible edit over a semantic markup document.
- Markup
Error - Error returned by markup backend and registry operations.
- Span
State - Source-span freshness after reversible document edits.
Constants§
- MARKUP_
CODEC_ PREFIX - Textual prefix for rendered markup codec symbols.
Statics§
- RECIPES
- Cookbook recipes embedded from this crate’s
recipes/directory.
Traits§
- Markup
Backend - A concrete markup reader/writer behind a runtime codec id.
Functions§
- apply_
edit - Apply a reversible markup edit to a document.
- backend_
catalog - Return the deterministic catalog of implemented and tracked markup backends.
- chunk
- Split a decoded
docintoDocChunks according toop. - decode_
document - Parse document
textinto aDocValue, recording per-block byte offsets and heading paths. - decode_
markup_ doc - Decode source text into the shared markup IR using the current lightweight document parser.
- default_
backend_ registry - Build the default registry installed by
install_doc_codec. - install_
doc_ codec - Install
DocCodecLibintocx, registeringcodec:docand thedoc/chunk-*functions with a freshly allocated codec id. - install_
markup_ codecs - Install each registered markup backend as
codec:markup/<id>. - invert_
edit - Return the inverse edit for
edit. - markup_
codec_ symbol - Return the runtime codec symbol for a markup backend id.