Skip to main content

Crate mdi_core

Crate mdi_core 

Source
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.

Structs§

Diagnostic
A recoverable parser message returned as part of the stable wire contract.
Document
The complete language-neutral document tree. children uses mdast’s stable tagged JSON shape (with MDI nodes injected by this crate); every source-backed node is annotated with a UTF-8 byte span.
Frontmatter
Ordered YAML front matter, retaining both recognized and unknown fields.
FrontmatterEntry
MdiSyntaxDocument
Transitional MDI-only document used by the compatibility helper parse_mdi_syntax. New callers must use parse_document.
ParseOutput
A binding-friendly parse envelope.
ParserCapabilities
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.
SourceSpan
Half-open UTF-8 byte range in the original source.

Enums§

DiagnosticSeverity
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.
PagebreakVariant
A page-break side.
RubyReading
The reading attached to a ruby base.
TextFormat
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.

Functions§

find_chromium
Locate common native Chromium installations. Production callers should prefer the explicit PdfOptions.chromium_path for deterministic deploys.
parse_document
Parse a complete .mdi document. CommonMark and all GFM constructs are parsed by markdown-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_output for FFI boundaries.
parse_mdi_syntax
Parse only MDI syntax for legacy callers. This is intentionally not the public whole-document entry point; use parse_document instead.
parse_output
Parse the complete CommonMark, GFM, front-matter, and MDI document and return the versioned wire envelope used by language bindings.
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_epub
Build a reflowable EPUB 3 archive entirely from Rust’s document IR. Metadata comes from front matter; richer cover and print-profile options are intentionally layered on this deterministic core API later.
render_epub_document
Build a reflowable EPUB 3 archive from a parsed document.
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_prefix is supplied by the host’s already-resolved export profile.
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.