Skip to main content

Crate sim_codec_doc

Crate sim_codec_doc 

Source
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 MarkupBackend trait, deterministic BackendRegistry, and fidelity/error contracts for backend implementations.
  • catalog: the implemented/tracked backend catalog for markup formats.
  • codec: the DocCodec decoder/encoder, the DocCodecLib host lib, and install_doc_codec plus codec:markup/<id> installation.
  • document: compatibility chunking wrappers (DocValue, DocFormat, DocBlock, DocChunk, ChunkOp), decode_document, and chunk.
  • 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-parser AsciiDoc backend.
  • latex: the codebook-tree-sitter-latex LaTeX backend.
  • markdown: the pulldown-cmark Markdown backend.
  • typst_backend: the typst-syntax Typst backend.

Structs§

AsciiDocBackend
Safe AsciiDoc markup backend.
BackendId
A backend identifier such as markdown, typst, asciidoc, or latex.
BackendInfo
Catalog row describing one markup backend or tracked format.
BackendRegistry
Deterministic registry of markup backends.
BasicMarkdownBackend
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:doc decoder/encoder.
DocCodecLib
The host-registered Lib that installs DocCodec as codec:doc and the doc/chunk-* chunking functions.
DocValue
A decoded document: its full source text, detected format, and the ordered DocBlocks parsed from it.
LatexBackend
Safe LaTeX article-subset backend.
MarkdownBackend
CommonMark/GFM-compatible Markdown backend.
MarkupCodec
Strict runtime codec for one markup backend.
MarkupDecodeOptions
Decode options shared by markup backends.
MarkupDoc
A semantic markup document independent of its concrete source backend.
MarkupEncodeOptions
Encode options shared by markup backends.
MarkupFidelity
Fidelity report returned by markup backends.
MarkupLoss
A single lossy conversion note.
MathSource
Markup math source with a notation label.
SourceDoc
A concrete source document preserved alongside the semantic IR.
Span
A source span in byte offsets.
TypstBackend
Safe Typst markup backend.

Enums§

BackendStatus
Implementation state for a cataloged markup backend.
ChunkOp
A chunking strategy selecting how chunk splits a DocValue.
DocBlockKind
The category of a DocBlock.
DocFormat
The detected surface format of a decoded document.
Inline
Inline content in a markup document.
MarkupBlock
A semantic block in a markup document.
MarkupEdit
A reversible edit over a semantic markup document.
MarkupError
Error returned by markup backend and registry operations.
SpanState
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§

MarkupBackend
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 doc into DocChunks according to op.
decode_document
Parse document text into a DocValue, 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 DocCodecLib into cx, registering codec:doc and the doc/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.