Skip to main content

Crate jubarte_markdown

Crate jubarte_markdown 

Source
Expand description

§jubarte-markdown

Markdown in and out of Word documents: markdown::markdown_to_docx writes CriticMarkup as tracked changes and comments, markdown::docx_to_markdown (with markdown::MarkdownOptions) projects a package to the agent view’s Markdown, and markdown::diff_markdown diffs two documents as pandiff-style CriticMarkup. legacy_doc reads Word 97-2003 .doc files.

The patch/redline/unified modules stay with the edit layer (T4.7); the facade composes them back into jubarte::markdown. With the render feature off, the layout-dependent items (page_texts, with_page_markers, page markers in reads) do not exist.

§Example

use jubarte_markdown::changes::list_changes;
use jubarte_markdown::markdown::{DocxOptions, diff_markdown, markdown_to_docx};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    // CriticMarkup becomes Word tracked changes.
    let options = DocxOptions { author: "Reviewer".into(), ..DocxOptions::default() };
    let written = markdown_to_docx("The term is {--two--}{++three++} years.\n", &options)?;
    assert!(!list_changes(&written.docx)?.is_empty());

    // Two Markdown texts diffed as CriticMarkup.
    let diff = diff_markdown("The term is two years.\n", "The term is three years.\n");
    assert!(diff.contains("three"));
    Ok(())
}

Modules§

admission
Input admission: budgets, refusal reasons, and the limits types the bindings and CLI expose. Resource admission for untrusted DOCX input: bound the ZIP container before anything inflates it without limits.
changes
Tracked changes one at a time: list, accept or reject a selection. Tracked changes one at a time: list each with an id, accept or reject a selection and keep the rest tracked, as Word’s Accept/Reject This Change does.
comments
Comment threads across the parts that hold them. Comment threads: list every comment with its thread position and the text it is anchored to, and write the comment part family whole.
comparer
The comparison core: atomizing, matching, and the redline writer. WmlComparer core (M4). Port of WmlComparer.ts.
debug
Maintainer triage views. jubarte debug: triage a .docx that Word refuses, or compare two builds of one. Every report is short on purpose. It counts findings by kind, shows a few examples of each (limit), and with two files prints only what differs.
document_comparer
One-call document comparison and revision accept/reject. DocumentComparer façade (M5). Port of DocumentComparer.ts (compare path).
ids
The one grammar of the ids jubarte prints and reads: ShortId (src/ids/short.rs, spec 2026-10-13 §2 and §2.1). The functions here are the options’ views of it: a change (r12, r1+2, header1.r1), a comment (c27), the text a comment covers (c27.text), and what -p takes (a paragraph p12, a story header1 or its paragraph header1.p2, a cell t0.row1.cell2[.p1], a comment, or changes).
inspect
Read-only paragraph/package views and the Markdown projection. Read-only views of a DOCX for agents and tools: body paragraphs an edit can address, package facts, and a Markdown projection that carries paragraph ids so the reader’s coordinates are the editor’s coordinates.
legacy_doc
Word 97-2003 .doc reading: text, headings and tables. Word 97-2003 (.doc) to text, paragraphs, headings, lists and tables: the main story, no headers or footers.
markdown
Markdown in and out of Word documents. Markdown to Word.
namespaces
WordprocessingML and related namespace / XName constants. WordprocessingML and related namespace / XName constants ported from PtOpenXmlUtil.ts (the subset the comparer references) — M1.7.
opc
Open Packaging Conventions adapter (PartFs). OPC (Open Packaging Conventions) layer — M1.5.
settings
Settings application (w:settings). Document settings an edit plan writes into word/settings.xml: Track Changes on or off, updateFields on open, and editing restrictions.
strict_translation
ISO Strict → Transitional package normalization. ISO/IEC 29500 Strict → Transitional namespace normalization (M8).
util
Shared small utilities. Small shared utilities, ported from PtUtil.ts (M1.6).
validate
Check that Word will open a package, and repair it. Word-validity findings beyond the schema: what makes Word refuse or repair a package, as data.
xmllinq
Arena DOM (xmllinq) used by the comparer. LINQ-to-XML-style mutable XML tree, ported from lib/xml-linq.ts.