hwpforge/
lib.rs

1//! # HwpForge
2//!
3//! Programmatic control of Korean HWP/HWPX documents.
4//!
5//! HwpForge lets you read, write, and convert [Hancom 한글](https://www.hancom.com/)
6//! documents from Rust. It targets the HWPX format (ZIP + XML, KS X 6101) used by
7//! modern versions of 한글.
8//!
9//! # Feature Flags
10//!
11//! | Feature | Default | Description |
12//! |---------|---------|-------------|
13//! | `hwpx`  | ✅      | HWPX encoder/decoder |
14//! | `md`    | —       | Markdown ↔ Core conversion |
15//! | `full`  | —       | All features |
16//!
17//! # Quick Start
18//!
19//! ```no_run
20//! use hwpforge::core::{Document, Draft, Paragraph, Run, Section};
21//! use hwpforge::foundation::HwpUnit;
22//!
23//! // Build a document programmatically
24//! let mut doc = Document::<Draft>::new();
25//! let section = Section::new(vec![
26//!     Paragraph::new("Hello, 한글!", Default::default()),
27//! ]);
28//! doc.add_section(section);
29//! ```
30//!
31//! ## Encode to HWPX
32//!
33//! ```no_run
34//! # use hwpforge::core::{Document, Draft};
35//! # let doc = Document::<Draft>::new();
36//! use hwpforge::hwpx::{HwpxEncoder, HwpxStyleStore};
37//! use hwpforge::core::ImageStore;
38//!
39//! let validated = doc.validate().unwrap();
40//! let style_store = HwpxStyleStore::with_default_fonts("함초롬바탕");
41//! let image_store = ImageStore::new();
42//! let bytes = HwpxEncoder::encode(&validated, &style_store, &image_store).unwrap();
43//! std::fs::write("output.hwpx", &bytes).unwrap();
44//! ```
45//!
46//! ## Decode from HWPX
47//!
48//! ```no_run
49//! use hwpforge::hwpx::HwpxDecoder;
50//!
51//! let result = HwpxDecoder::decode_file("input.hwpx").unwrap();
52//! println!("Sections: {}", result.document.sections().len());
53//! ```
54
55/// Foundation types: [`HwpUnit`](foundation::HwpUnit), [`Color`](foundation::Color),
56/// branded indices, and core enums.
57pub use hwpforge_foundation as foundation;
58
59/// Format-independent document model: [`Document`](core::Document),
60/// [`Section`](core::Section), [`Paragraph`](core::Paragraph),
61/// [`Table`](core::Table), [`Control`](core::Control).
62pub use hwpforge_core as core;
63
64/// YAML-based style template system with inheritance and merge.
65pub use hwpforge_blueprint as blueprint;
66
67/// HWPX format codec (encoder + decoder).
68#[cfg(feature = "hwpx")]
69pub use hwpforge_smithy_hwpx as hwpx;
70
71/// Markdown codec (GFM decoder + lossy/lossless encoder).
72#[cfg(feature = "md")]
73pub use hwpforge_smithy_md as md;