docparser-core 0.2.0

docparser 独立解析核心:IR / 统一错误 / 能力 trait / Registry / Router / Policy(零 native 依赖)
Documentation
//! `docparser-core`:独立文档解析核心(IR / 统一错误 / 能力抽象 / 注册路由 / 策略 / 引擎)。
//!
//! 与 Python 参考实现(`python/docparser/`)共享同一 IR 语义与错误码;
//! 是发布形态(见 design_docs 06_release_shape.md)的 Rust 侧核心库。
//! 本 crate 零第三方运行依赖(仅 serde 用于 JSON 往返)。
//!
//! # 示例
//!
//! ```no_run
//! use docparser_core::{plugins, DocumentEngine, Registry};
//!
//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let mut registry = Registry::new();
//! plugins::text::register_defaults(&mut registry); // txt / md / csv / html
//! let engine = DocumentEngine::new(registry);
//!
//! let doc = engine.parse("note.md")?;
//! println!("{} 页 / {} 字符", doc.pages.len(), doc.meta.text_length);
//! for block in &doc.pages[0].blocks {
//!     println!("{:?}: {}", block.kind, block.content);
//! }
//! # Ok(())
//! # }
//! ```
//!
//! 接入其它格式只需注册对应后端(`docparser_pdf::register_defaults` /
//! `docparser_office::register_defaults` …),见 [`Registry`] 与 [`DocumentEngine`]。

pub mod emit;
pub mod engine;
pub mod error;
pub mod model;
pub mod plugin;
pub mod plugins;
pub mod policy;
pub mod registry;
pub mod router;

pub use engine::DocumentEngine;
pub use error::{DocError, ErrorCode, Result};
pub use model::{Block, BlockKind, DocMeta, Document, Image, Page, Rect, TableData};
pub use plugin::{
    BackendKind, FormatPlugin, ParseCapability, ProcessCapability, RawDoc, RawImage, RawPage,
    RawTextItem,
};
pub use registry::{Registry, RegistryError};