Skip to main content

Crate deepdoc_core

Crate deepdoc_core 

Source
Expand description

DeepDoc core — any document to clean Markdown, JSON or text.

The engine is built around a format-neutral Document model and the Extractor trait:

detect  file type      → which Extractor
extract file + parsing → Document        (the only impure edge)
render  Document       → Markdown | JSON | text   (pure)
chunk   Document       → RAG chunks               (pure)

Adding a format means adding an Extractor; neither the CLI nor the serializers change.

use deepdoc_core::{extract::{self, ExtractOpts}, render::{self, RenderOpts}};

let doc = extract::extract_path("notes.txt".as_ref(), &ExtractOpts::default())?;
print!("{}", render::to_markdown(&doc, &RenderOpts::default()));

Re-exports§

pub use detect::Format;
pub use detect::detect_path;
pub use error::Error;
pub use error::Result;
pub use error::exit_code;
pub use extract::ExtractOpts;
pub use extract::Extractor;
pub use extract::extract_path;
pub use model::Block;
pub use model::Document;
pub use model::Inline;
pub use model::Metadata;
pub use model::Row;
pub use model::Span;
pub use render::OutputFormat;
pub use render::RenderOpts;
pub use render::render;
pub use render::to_json;
pub use render::to_markdown;
pub use render::to_text;

Modules§

chunk
RAG chunking: Document → chunks that carry their heading context.
detect
File type detection: signature first, extension as a hint.
error
Core error type. The CLI maps these onto the exit codes from the spec.
extract
The Extractor trait and the registry that maps a Format onto one.
model
The Document IR — the format-neutral model every extractor produces and every renderer consumes.
render
Serializers: Document → Markdown | JSON | text.