deepdoc_core/lib.rs
1//! DeepDoc core — any document to clean Markdown, JSON or text.
2//!
3//! The engine is built around a format-neutral [`Document`](model::Document)
4//! model and the [`Extractor`](extract::Extractor) trait:
5//!
6//! ```text
7//! detect file type → which Extractor
8//! extract file + parsing → Document (the only impure edge)
9//! render Document → Markdown | JSON | text (pure)
10//! chunk Document → RAG chunks (pure)
11//! ```
12//!
13//! Adding a format means adding an `Extractor`; neither the CLI nor the
14//! serializers change.
15//!
16//! ```no_run
17//! use deepdoc_core::{extract::{self, ExtractOpts}, render::{self, RenderOpts}};
18//!
19//! let doc = extract::extract_path("notes.txt".as_ref(), &ExtractOpts::default())?;
20//! print!("{}", render::to_markdown(&doc, &RenderOpts::default()));
21//! # Ok::<(), deepdoc_core::Error>(())
22//! ```
23
24pub mod chunk;
25pub mod detect;
26pub mod error;
27pub mod extract;
28pub mod model;
29pub mod render;
30
31pub use detect::{Format, detect_path};
32pub use error::{Error, Result, exit_code};
33pub use extract::{ExtractOpts, Extractor, extract_path};
34pub use model::{Block, Document, Inline, Metadata, Row, Span};
35pub use render::{OutputFormat, RenderOpts, render, to_json, to_markdown, to_text};