A fast, helpful, and open-source document parser
nit
Logan Markewichbe7e82bc0ca1
diff --git a/crates/liteparse/src/markdown_layout/blocks.rs b/crates/liteparse/src/markdown_layout/blocks.rsindex 4bdb06c..59c483f 100644--- a/crates/liteparse/src/markdown_layout/blocks.rs+++ b/crates/liteparse/src/markdown_layout/blocks.rs@@ -181,12 +181,8 @@ pub enum Block {/// the merge structure outright (e.g. a structural reader with access to/// `gridSpan` / `vMerge`) rather than inferring it from coordinates.///- /// `rows` is *not* rectangular: a cell absorbed by a neighbour's- /// `colspan`/`rowspan` is omitted entirely, exactly as in HTML. `header_rows`- /// is the count of leading rows that are header rows (`<th>`); 0 means none.- ////// Renders as a GFM pipe table when it degenerates to a plain grid, and as- /// HTML `<table>` otherwise — pipe tables cannot express spans at all.+ /// HTML `<table>` otherwise.MergedTable {rows: Vec<Vec<SpanCell>>,header_rows: usize,diff --git a/crates/liteparse/src/parser.rs b/crates/liteparse/src/parser.rsindex 9b33177..9a2b4f6 100644--- a/crates/liteparse/src/parser.rs+++ b/crates/liteparse/src/parser.rs@@ -992,29 +992,11 @@ impl LiteParse {Ok((pages, page_blocks, page_stats, page_filtered))}- /// `parse_from_pages`'s structural sibling: the caller owns block-level+ /// Build the output directly from blocks: the caller owns block-level/// structure (headings, lists, tables, merged cells) alongside the text/// items, so per-page markdown renders from the block model with/// `render_blocks` while page `.text` still comes from grid projection- /// over the supplied text items — the same spatial text layout every- /// other path produces. Like `parse_from_pages` this never touches- /// PDFium or OCR and is fully synchronous; text items arrive in viewport- /// space (top-left origin, 72 DPI). `page_blocks` must align 1:1 with- /// `pages`; `page_stats` carries per-page complexity (or `None`s).- /// Blocks arrive as [`PositionedBlock`](crate::markdown_layout::- /// PositionedBlock)s — a producer without per-block geometry wraps each- /// with `PositionedBlock::unlocated`. When `extract_blocks` is on, the- /// supplied blocks (and their boxes) also populate each page's `blocks`,- /// mirroring the classifier path.- ///- /// Doc-level markdown renders from `all_blocks` when given, NOT by- /// joining the page renders: `render_blocks` is context-sensitive across- /// block boundaries (tight lists join with `\n`, soft-hyphen paragraph- /// splices join with nothing), so a page-boundary join would perturb- /// whitespace wherever a page break falls inside a list. The per-page- /// markdown is the paged *view* of the same blocks. `target_pages` /- /// `max_pages` filtering drops `all_blocks` and falls back to joining- /// the surviving pages.+ /// over the supplied text items.pub fn parse_from_blocks(&self,pages: Vec<Page>,diff --git a/docs/src/content/docs/liteparse/guides/multi-format.mdx b/docs/src/content/docs/liteparse/guides/multi-format.mdxindex 4d330d9..0cfdd45 100644--- a/docs/src/content/docs/liteparse/guides/multi-format.mdx+++ b/docs/src/content/docs/liteparse/guides/multi-format.mdx@@ -47,45 +47,6 @@ choco install libreoffice-fresh> On Windows, you may need to add the LibreOffice CLI directory (typically `C:\Program Files\LibreOffice\program`) to your PATH and restart.-### Fonts (optional, affects DOCX geometry)--DOCX files carry no coordinates — not for a page, a line, or a character. LiteParse-lays the document out itself, measuring the actual glyphs to decide where every word-lands. So a bounding box is only as accurate as the font behind it.--When a document asks for a font you don't have, LiteParse falls back to a generic-sans. Text and structure are unaffected — headings, lists, tables and reading order-are read from the file, not from the layout — but bounding-box coordinates shift, and-they shift differently on different machines. That matters if you use-[visual citations](/liteparse/guides/visual-citations), highlight regions on a-screenshot, or compare geometry across hosts.--```bash-./scripts/install-fonts.sh # metric clones + common open fonts-./scripts/install-fonts.sh --metric # metric clones only-./scripts/install-fonts.sh --dry-run # print the commands, install nothing-```--The script installs only freely-redistributable fonts, of two kinds:--- **Metric-compatible clones** of the Microsoft fonts — Carlito for Calibri, Caladea- for Cambria, Liberation/Croscore for Arial, Times New Roman and Courier New. These- have the original's advance widths glyph for glyph, so text measured against them- lands where the real font would have put it. This is the half that makes geometry- *reproducible*, not merely plausible.-- **Common open fonts** that real documents use — Open Sans, Lato, Roboto, Montserrat- and similar. Matched exactly, no substitution involved.--It does **not** install Calibri, Aptos, Corbel or Franklin Gothic themselves — those-are licensed by Microsoft and aren't ours to distribute. For Calibri and Cambria that-costs nothing, since the clones above stand in exactly. For Aptos, Corbel and Franklin-Gothic no free metric clone exists, so documents using them stay approximate unless-you have Microsoft Office installed.--On a 45-document corpus, running the script took the share of text measured against a-generic fallback from **64% to 14%**, with the remainder dominated by those-Microsoft-only faces.-## UsageOnce the dependencies are installed, just pass any supported file to `lit parse`: