Skip to main content

Crate carta_core

Crate carta_core 

Source
Expand description

Shared carta core: the conversion traits, their option types, and the common error type.

Reader turns input text into a Document; Writer turns a Document back into output text. Readers and writers depend only on the AST contract and this crate, so input and output formats stay independent.

Re-exports§

pub use extensions::Extension;
pub use extensions::Extensions;
pub use extensions::presets;
pub use media::MediaBag;
pub use media::MediaItem;
pub use stack::DEEP_STACK;
pub use stack::DeepStack;
pub use stack::on_deep_stack;

Modules§

budget
A ceiling on how far a writer may amplify the document it renders.
containercontainer
Packaging primitives shared by container-based document formats.
extensions
Format extensions: the set of optional syntax features a reader or writer may honor.
media
The media bag: a document’s embedded resources (images and other binary payloads), carried alongside the syntax tree rather than inside it.
sections
Section numbering and table-of-contents construction over the document model.
stack
Running recursion-heavy work on a large, dedicated stack.
templatetemplate
A small string-template engine: variables, conditionals, loops, pipes, and partials over a Value context. The language uses $-delimited directives; see parse for the grammar and the surrounding module docs for whitespace handling.
walk
Mutable traversals over the document model.

Structs§

DocxOptions
Options for the DOCX container writer. Ignored by every other writer. The default produces a self-contained document from the built-in template, with reproducible property timestamps and a language tag drawn from the document or the environment.
EpubOptions
Options for the EPUB container writer. Ignored by every other writer. The default is an empty book: no cover, no embedded fonts, the built-in stylesheet only, and chapters split at the top heading level.
HighlightOptionshighlight
Syntax-highlighting configuration for the writers that colorize code blocks (the HTML family, LaTeX, and DOCX). The default leaves code blocks unhighlighted.
ReaderOptions
Options controlling a Reader.
Slot
The position rendered text occupies in the layout that receives it: the column its first line starts at, and the indent its continuation lines carry. A writer that reflows to a fill column subtracts these so the text fits the place it lands in rather than the left margin.
WriterOptions
Options controlling a Writer.

Enums§

AnyReader
A resolved reader, either text-shaped (Reader) or byte-shaped (BytesReader).
AnyWriter
A resolved writer, either text-shaped (Writer) or byte-shaped (BytesWriter).
Error
The error type returned across the conversion pipeline.
MathMethod
How math is presented by a format that offers a choice of renderers (the HTML family). The method decides both the inline markup inside a span.math and which loader a standalone document pulls in to typeset it: a MathJax (or plain) document carries the source TeX wrapped in \(…\) / \[…\], whereas a KaTeX document carries the bare TeX, which its in-browser loader reads from the span directly.
MetaVarStyle
Which plain-text identity variables a writer’s standalone template draws on. The document’s title, authors, and date are exposed as markup-free, target-escaped text for places that cannot carry markup (a web document head or a PDF document’s properties). See Writer::meta_var_style.
Output
The output of a conversion: text from a text writer, bytes from a byte-shaped writer.
TocStyle
How a writer supplies a table of contents.
TopLevelDivision
The division a format with a named sectioning hierarchy gives the document’s top heading level.
WrapMode
How a text writer lays out the lines of a paragraph.

Constants§

FLUSH_LINE
Opens a line that a template must leave at column zero, however far the slot the value lands in is indented. A writer marks the lines of a construct whose own layout is its content (verbatim text, say) and the template rendering strips the mark along with the indentation before it. Document text cannot carry the character: escaping drops it in every format that marks lines.

Traits§

BytesReader
Parses input bytes in some source format into the document model. The byte-shaped counterpart of Reader, for formats whose wire form is not text (zip containers and the like).
BytesWriter
Renders the document model into some target format’s bytes. The byte-shaped counterpart of Writer, for formats whose output is not text (zip containers and the like).
Reader
Parses input text in some source format into the document model.
Writer
Renders the document model into some target format’s text.

Type Aliases§

Result
A Result whose error is Error.