Skip to main content

easypdf_markdown/table/
mod.rs

1//! 用于 PDF 转 Markdown 的启发式表格检测。
2//!
3//! 本模块提供 [`TableDetectorProcessor`],它是
4//! [`PdfMarkdownProcessor`](crate::PdfMarkdownProcessor) 的一个实现,
5//! 扫描段落块中的表格模式并将其替换为
6//! [`PdfBlock::Table`](easypdf_core::PdfBlock::Table) 块。
7//!
8//! # 支持的模式
9//!
10//! | 模式 | 示例 | 分隔符 |
11//! |------|------|--------|
12//! | 管道 | `\| Name \| Age \|` | `\|` 字符 |
13//! | 制表符 | `Name\tAge` | 制表符 |
14//! | 空格 | `Name    Age    City` | 2 个以上连续空格 |
15//!
16//! # 快速开始
17//!
18//! ```
19//! use easypdf_markdown::{ProcessorPipeline, PdfMarkdownProcessor};
20//! use easypdf_markdown::table::TableDetectorProcessor;
21//!
22//! let mut pipeline = ProcessorPipeline::new();
23//! pipeline.register(Box::new(TableDetectorProcessor::new()));
24//! ```
25//!
26//! # 配置
27//!
28//! 使用 [`TableDetectionConfig`](crate::table::TableDetectionConfig) 调整:
29//! - 最小行/列数
30//! - 列分隔策略(Pipe、Tab、Whitespace 或 Auto)
31//! - 是否允许不规则列数
32
33pub mod config;
34mod detector;
35mod heuristic;
36mod parser;
37#[cfg(test)]
38mod tests;
39
40pub use config::{ColumnSeparator, TableDetectionConfig};
41pub use detector::TableDetectorProcessor;