jubarte_edit/lib.rs
1// SPDX-FileCopyrightText: 2026 Jandira Technologies, LLC
2//
3// SPDX-License-Identifier: Apache-2.0
4
5//! # jubarte-edit
6//!
7//! The edit product of the jubarte engine: `edit::apply_plan` /
8//! `apply_plan_json` write an edit plan as tracked changes (rewrite,
9//! insert, tables, lists, run formatting, footnotes, images, page setup,
10//! content controls, watermark, redact, settings, field updates),
11//! `text_diff` renders text diffs as the agent view prints them,
12//! `expect` checks plans against their schema, `capabilities` names what
13//! the bindings expose, and `publication` stages host filesystem output.
14//! The composed `markdown` module adds the patch, redline and unified
15//! views to the markdown crate's reader and writer.
16//!
17//! # Example
18//!
19//! ```rust,no_run
20//! use jubarte_edit::edit::apply_plan_json;
21//!
22//! fn main() -> Result<(), Box<dyn std::error::Error>> {
23//! let source = std::fs::read("contract.docx")?;
24//! // Paragraph ids (`p12`) are the ones `jubarte read contract.docx` prints.
25//! let plan = r#"{
26//! "schema_version": 1,
27//! "author": "Reviewer",
28//! "operations": [{
29//! "id": "term",
30//! "kind": "replace",
31//! "paragraph": "p12",
32//! "find": "two years",
33//! "replacement": "three years"
34//! }]
35//! }"#;
36//! let result = apply_plan_json(&source, plan)?;
37//! std::fs::write("contract_redline.docx", &result.redline)?;
38//! std::fs::write("contract_clean.docx", &result.clean)?;
39//! Ok(())
40//! }
41//! ```
42
43#![cfg_attr(all(coverage_nightly, test), feature(coverage_attribute))]
44#![forbid(unsafe_code)]
45#![warn(missing_docs)]
46
47// A5 shims: every layer below under the names the moved code uses.
48#[cfg(feature = "render")]
49pub(crate) use jubarte_doc::fields;
50pub(crate) use jubarte_doc::{audit, scrub};
51pub use jubarte_doc::{changes, comment_settlement, comments, debug, inspect, validate};
52pub(crate) use jubarte_dom::ooxml;
53pub use jubarte_dom::{ids, namespaces, util, xmllinq};
54pub use jubarte_opc::{admission, opc, settings, strict_translation};
55pub mod markdown;
56pub use jubarte_redlines::{comparer, document_comparer, revision_processor};
57
58/// What the bindings expose, feature by feature.
59pub mod capabilities;
60/// Tracked-change editing: plans in, redlines and clean copies out.
61pub mod edit;
62/// The `--expect` plan checker.
63pub mod expect;
64/// Host filesystem publication, capability-confined and staged.
65/// Host filesystem publication is unavailable to browser/WASM byte APIs.
66#[cfg(not(target_arch = "wasm32"))]
67pub mod publication;
68/// Stable result codes the bindings print.
69pub mod result;
70/// Text diff views (agent view and CriticMarkup).
71pub mod text_diff;