Expand description
The language-neutral MDI 2.0 syntax core.
Rust is the sole executable syntax authority for an MDI document. It parses CommonMark, GFM, YAML front matter, and MDI into one portable wire tree; language bindings only adapt that tree to their host APIs.
Modules§
- ffi
- Stable C ABI used by native language bindings.
Structs§
- Chromium
Print Page - Chromium
Print Page Numbers - Chromium
Print Profile - Diagnostic
- A recoverable parser message returned as part of the stable wire contract.
- Document
- The complete language-neutral document tree.
childrenuses mdast’s stable tagged JSON shape (with MDI nodes injected by this crate); every source-backed node is annotated with a UTF-8 bytespan. - Epub
Cover - Frontmatter
- Ordered YAML front matter, retaining both recognized and unknown fields.
- Frontmatter
Entry - Margins
- MdiSource
Span Text Resolution - Result of resolving one half-open UTF-8 source span back to canonical text.
- MdiSyntax
Document - Transitional MDI-only document used by the compatibility helper
parse_mdi_syntax. New callers must useparse_document. - MdiText
Annotation - MdiText
Block - MdiText
Blocks Result - MdiText
Position - A one-based block/Unicode-grapheme position, serialized as
3:18. - MdiText
Range - MdiText
Source Map - MdiText
Source Run - Page
Numbers - Page
Size Dimensions - Parse
Output - A binding-friendly parse envelope.
- Parser
Capabilities - Parser features represented in a
ParseOutput. - PdfOptions
- Native configuration for Chromium PDF layout. WebAssembly deliberately cannot expose this operation because it cannot launch a local process.
- Resolved
Epub - Resolved
Export Profile - Resolved
Layout - Resolved
Pagination - Resolved
Text - Resolved
Typesetting - Source
Span - Half-open UTF-8 byte range in the original source.
- Warichu
Fragment - Warichu
Options - Warichu
Source
Enums§
- Diagnostic
Severity - Severity of a parser diagnostic.
- Inline
- A language-neutral MDI inline AST.
- MdiBlock
- A block-level MDI construct or ordinary source line in the compatibility helper.
- MdiSource
Span Coverage - How much of a non-empty source span belongs to mapped graphemes.
- MdiSource
Span Relation - Relationship between a canonical match’s forward source coverage and the requested source span.
- MdiSource
Span Resolution Error - Validation error returned by
resolve_mdi_source_span. - MdiSource
Span Text Match - A maximal adjacent canonical range in either block text or one annotation.
- MdiText
Block Kind - Pagebreak
Variant - A page-break side.
- Ruby
Reading - The reading attached to a ruby base.
- Text
Format - Text export conventions supported by the portable core.
Constants§
- MDI_
IR_ VERSION - Version of the language-neutral wire format returned by the bindings.
- MDI_
SPEC_ VERSION - MDI syntax version implemented by this crate.
- MDI_
STYLESHEET - The base stylesheet is intentionally shipped by the core alongside the semantic HTML. Hosts may add presentation CSS, but not reinterpret nodes.
- MDI_
TEXT_ PROJECTION_ VERSION
Functions§
- apply_
pdf_ profile - Convert a resolved profile into isolated print CSS. This is kept in the language-neutral core so every present and future binding has identical page geometry and Japanese composition behavior.
- apply_
pdf_ profile_ json - find_
chromium - Locate common native Chromium installations. Production callers should
prefer the explicit
PdfOptions.chromium_pathfor deterministic deploys. - get_
mdi_ text_ blocks - Parse once and produce the complete IR envelope plus the Rust-owned text projection and its UTF-8 source map.
- get_
mdi_ text_ blocks_ json - layout_
warichu - Split already parsed inline children; capacity is half-em units at 50% type. Ruby, tcy, no-break, and unknown inline containers remain indivisible. An unavailable browser measurement can use 40 (20 note em) as a fallback.
- layout_
warichu_ options_ json - layout_
warichu_ with_ options - page_
dimensions - page_
size_ catalog_ json - parse_
document - Parse a complete
.mdidocument. CommonMark and all GFM constructs are parsed bymarkdown-rs; MDI is then lowered into the same tagged tree in Rust. The host never tokenizes Markdown or MDI. - parse_
inlines - Parse MDI inline syntax while keeping all other text literal.
- parse_
json - Serialize
parse_outputfor FFI boundaries. - parse_
mdi_ syntax - Parse only MDI syntax for legacy callers. This is intentionally not the
public whole-document entry point; use
parse_documentinstead. - parse_
output - Parse the complete CommonMark, GFM, front-matter, and MDI document and return the versioned wire envelope used by language bindings.
- prepare_
chromium_ print_ profile - Resolve a raw export profile and prepare all browser-independent Chromium print data in Rust. Browser bindings only launch the browser and pass these values to its native PDF API.
- prepare_
chromium_ print_ profile_ json - prepare_
chromium_ print_ profile_ resolved - render_
docx - Build a baseline DOCX archive directly from Rust IR. It deliberately uses WordprocessingML rather than a host document library, so source syntax and document meaning remain inside the core.
- render_
docx_ document - Build a baseline DOCX archive from a parsed document.
- render_
docx_ document_ with_ profile - render_
docx_ with_ profile - Build a configured DOCX through the canonical Rust OOXML writer.
- render_
epub - Build a reflowable EPUB 3 archive entirely from Rust’s document IR.
- render_
epub_ document - Build a reflowable EPUB 3 archive from a parsed document.
- render_
epub_ document_ with_ profile - render_
epub_ with_ profile - Build an EPUB with the canonical configured-export profile.
- render_
html - Render a complete source document to a standalone HTML document directly from the Rust-owned IR. This is intentionally source-oriented for FFI: bindings pass UTF-8 source once and never reconstruct MDI syntax in a host renderer.
- render_
html_ document - Render a previously parsed document to standalone HTML.
- render_
pdf - Render PDF by asking a locally installed Chromium-compatible browser to lay out Rust-generated HTML. Chromium never receives MDI source.
- render_
text - Render source to deterministic plain text from the Rust IR. Typography annotations are represented by their readable base text; page and blank paragraph boundaries remain visible as newlines.
- render_
text_ document - Render a parsed document to plain text.
- render_
text_ format - Render a publication-platform text variant from Rust IR.
indent_prefixis supplied by the host’s already-resolved export profile. - resolve_
export_ profile - resolve_
export_ profile_ json - resolve_
mdi_ source_ span - Resolve a half-open UTF-8 source span to every mapped canonical grapheme range. Block text and annotation text are independent channels.
- resolve_
mdi_ source_ span_ json - JSON boundary for language bindings.
- resolve_
mdi_ source_ spans - Resolve many source spans after parsing and projecting
sourceexactly once. Input order is preserved in the returned resolutions. - resolve_
mdi_ source_ spans_ json - Batched JSON boundary for language bindings. The source is parsed once for all spans, and the returned array follows input order.
- serialize_
mdi - Parse and serialize source to canonical MDI/Markdown spelling in Rust.
- serialize_
mdi_ document - Serialize a parsed document without invoking a host Markdown serializer.
Type Aliases§
- MdiAnnotation
Source Map - Annotation text uses the containing block number and its own one-based character offsets. This keeps the run format identical in both channels.