A fast, helpful, and open-source document parser
nits
Logan Markewichc55740147299
diff --git a/crates/liteparse-napi/src/types.rs b/crates/liteparse-napi/src/types.rsindex f330ce5..bbe9ad2 100644--- a/crates/liteparse-napi/src/types.rs+++ b/crates/liteparse-napi/src/types.rs@@ -411,8 +411,6 @@ pub struct JsParsedPage {pub text: String,pub markdown: String,pub text_items: Vec<JsTextItem>,- /// Per-page complexity signals. Present only when parsing was configured- /// with `includeComplexity`; `undefined`/`None` otherwise.pub complexity: Option<JsPageComplexityStats>,}diff --git a/crates/liteparse-python/src/lib.rs b/crates/liteparse-python/src/lib.rsindex 6d0b62b..a089d57 100644--- a/crates/liteparse-python/src/lib.rs+++ b/crates/liteparse-python/src/lib.rs@@ -134,8 +134,6 @@ struct PyParsedPage {markdown: String,#[pyo3(get)]text_items: Vec<PyTextItem>,- /// Per-page complexity signals. Populated only when parsing was configured- /// with `include_complexity=True`; `None` otherwise.#[pyo3(get)]complexity: Option<PyPageComplexityStats>,}diff --git a/crates/liteparse-wasm/src/lib.rs b/crates/liteparse-wasm/src/lib.rsindex 26c9d17..a2db51b 100644--- a/crates/liteparse-wasm/src/lib.rs+++ b/crates/liteparse-wasm/src/lib.rs@@ -263,8 +263,6 @@ pub struct ParsedPage {pub text: String,pub markdown: String,pub text_items: Vec<TextItem>,- /// Per-page complexity signals. Present only when parsing was configured- /// with `includeComplexity`; omitted otherwise.#[serde(skip_serializing_if = "Option::is_none")]pub complexity: Option<PageComplexityStats>,}diff --git a/crates/liteparse/src/config.rs b/crates/liteparse/src/config.rsindex a720b9c..75ec5c3 100644--- a/crates/liteparse/src/config.rs+++ b/crates/liteparse/src/config.rs@@ -74,9 +74,7 @@ pub struct LiteParseConfig {/// Compute per-page complexity signals during `parse` and attach them to/// each `ParsedPage` (surfaced as a `complexity` object per page in JSON)./// These are the same signals the standalone `is_complex` API returns.- /// Default `false`: the vector-text detection walk this runs is only worth- /// paying for when a caller actually consumes the signals, so parse stays- /// on its cheap path unless this is explicitly opted into.+ /// Default `false`.pub include_complexity: bool,}diff --git a/crates/liteparse/src/output/json.rs b/crates/liteparse/src/output/json.rsindex e218991..980de9d 100644--- a/crates/liteparse/src/output/json.rs+++ b/crates/liteparse/src/output/json.rs@@ -24,8 +24,6 @@ pub(crate) struct JsonPage {pub height: f32,pub text: String,pub text_items: Vec<JsonTextItem>,- /// Per-page complexity signals. Present only when parsing was configured- /// with `include_complexity` (otherwise omitted from the JSON entirely).#[serde(skip_serializing_if = "Option::is_none")]pub complexity: Option<PageComplexityStats>,}diff --git a/crates/liteparse/src/parser.rs b/crates/liteparse/src/parser.rsindex e82f0a2..e00cee2 100644--- a/crates/liteparse/src/parser.rs+++ b/crates/liteparse/src/parser.rs@@ -324,9 +324,7 @@ impl LiteParse {} else {Vec::new()};- // Per-page complexity signals, opt-in via `include_complexity`. Needs- // the live PDFium document (image / filled-path geometry), so it runs- // here inside the lock; empty otherwise so the cheap path pays nothing.+let complexity = if self.config.include_complexity {pages.iter()