From 96c848798408370cba30b9930a89b6a73d1b9aa8 Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Fri, 13 Nov 2026 01:30:54 -0500 Subject: [PATCH] Add shared InDesign conversion facade --- Cargo.lock | 12 ++++++++++++ Cargo.toml | 2 ++ crates/indd/Cargo.toml | 14 ++++++++++++++ crates/indd/src/lib.rs | 16 ++++++++++++++++ 4 files changed, 44 insertions(+) create mode 100644 crates/indd/Cargo.toml create mode 100644 crates/indd/src/lib.rs diff --git a/Cargo.lock b/Cargo.lock index 174984c1d..03a7e15f9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1638,6 +1638,13 @@ dependencies = [ "zip", ] +[[package]] +name = "craft-indd" +version = "0.1.0" +dependencies = [ + "indd", +] + [[package]] name = "craft-jmap" version = "0.1.0" @@ -4738,6 +4745,11 @@ version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "65b27460c2c92b037f3f94c538ed9a3342f3fdf923606781629ccb35f82d042a" +[[package]] +name = "indd" +version = "0.1.0" +source = "git+https://github.com/storytold/indd-utils?rev=7f3060e5bce78d21ea70e0d5eacb96edce15dfbe#7f3060e5bce78d21ea70e0d5eacb96edce15dfbe" + [[package]] name = "indexmap" version = "2.14.2" diff --git a/Cargo.toml b/Cargo.toml index 4735dba39..bc06a403b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -65,6 +65,7 @@ craft-fig = { path = "crates/fig" } craft-fonts-build = { path = "crates/fonts-build" } craft-i18n = { path = "crates/i18n" } craft-idml = { path = "crates/idml" } +craft-indd = { path = "crates/indd" } craft-jmap = { path = "crates/jmap" } craft-ical = { path = "crates/ical" } craft-jpeg = { path = "crates/jpeg" } @@ -126,6 +127,7 @@ craft-vectordrawable = { path = "crates/vectordrawable" } craft-xls = { path = "crates/xls" } craft-wordmodel = { path = "crates/wordmodel" } craft-xlsx = { path = "crates/xlsx" } +indd = { git = "https://github.com/storytold/indd-utils", rev = "7f3060e5bce78d21ea70e0d5eacb96edce15dfbe" } craft-xcf = { path = "crates/xcf" } craft-xml = { path = "crates/xml" } craft-zip = { path = "crates/zip" } diff --git a/crates/indd/Cargo.toml b/crates/indd/Cargo.toml new file mode 100644 index 000000000..874ccb0d6 --- /dev/null +++ b/crates/indd/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "craft-indd" +description = "Shared InDesign document to IDML conversion facade for Craft applications" +version.workspace = true +edition.workspace = true +license.workspace = true +repository.workspace = true +rust-version.workspace = true + +[dependencies] +indd = { workspace = true } + +[lints] +workspace = true diff --git a/crates/indd/src/lib.rs b/crates/indd/src/lib.rs new file mode 100644 index 000000000..2cce05c0d --- /dev/null +++ b/crates/indd/src/lib.rs @@ -0,0 +1,16 @@ +//! Shared InDesign document conversion boundary. +//! +//! InDesign's binary document model is converted to IDML here. Applications can import the +//! resulting package through [`craft_idml`] while retaining only their own model and UI mapping. + +pub use indd::{Conversion, Error, Preview, Warning}; + +/// Whether `bytes` begins with the fixed signature of an InDesign document. +pub fn is_indd(bytes: &[u8]) -> bool { + bytes.starts_with(&indd::header::SIGNATURE) +} + +/// Convert an InDesign document to IDML. `name` is the file name stored in the package. +pub fn convert(bytes: &[u8], name: &str) -> Result { + indd::convert(bytes, name) +}