A fast, helpful, and open-source document parser
move stuff around
Logan Markewiche408a86500c7
diff --git a/docs/src/content/docs/liteparse/getting_started.md b/docs/src/content/docs/liteparse/getting_started.mdnew file mode 100644index 0000000..9169ec9--- /dev/null+++ b/docs/src/content/docs/liteparse/getting_started.md@@ -0,0 +1,63 @@+---+title: Getting Started+description: Install LiteParse and parse your first document in under a minute.+sidebar:+ order: 1+---++## Installation++Install LiteParse globally via npm to use the `lit` command anywhere:++```bash+npm i -g @llamaindex/liteparse+```++For macOS and Linux users, LiteParse can be also installed via `brew`:++```bash+brew tap run-llama/liteparse+brew install llamaindex-liteparse+```++## Quick start++Once installed, you can start parsing from the command line:++```bash+# Parse a PDF and print text to stdout+lit parse document.pdf++# Save output to a file+lit parse document.pdf -o output.txt++# Get structured JSON with bounding boxes+lit parse document.pdf --format json -o output.json++# Parse only specific pages+lit parse document.pdf --target-pages "1-5,10,15-20"+```++### Batch parsing++Parse an entire directory of documents at once:++```bash+lit batch-parse ./pdfs ./outputs+```++### Screenshots++Generate page images from a PDF for LLM agents or visual workflows:++```bash+lit screenshot document.pdf -o ./screenshots+```++## Next steps++- [Library usage](/liteparse/guides/library-usage/): Use LiteParse programmatically from TypeScript or Python.+- [OCR configuration](/liteparse/guides/ocr/): Configure Tesseract, use an external OCR server, or bring your own.+- [Multi-format support](/liteparse/guides/multi-format/): Parse DOCX, XLSX, PPTX, images, and more.+- [Agent skill](/liteparse/guides/agent-skill/): Add LiteParse as a skill for coding agents.+- [CLI reference](/liteparse/cli-reference/): Complete command and option reference.diff --git a/docs/src/content/docs/liteparse/guides/_meta.yml b/docs/src/content/docs/liteparse/guides/_meta.ymlnew file mode 100644index 0000000..06e2c20--- /dev/null+++ b/docs/src/content/docs/liteparse/guides/_meta.yml@@ -0,0 +1,3 @@+label: Guides+order: 2+collapsed: falsediff --git a/docs/src/content/docs/liteparse/agent-skill.md b/docs/src/content/docs/liteparse/guides/agent-skill.mdsimilarity index 100%rename from docs/src/content/docs/liteparse/agent-skill.mdrename to docs/src/content/docs/liteparse/guides/agent-skill.mddiff --git a/docs/src/content/docs/liteparse/guides/library-usage.md b/docs/src/content/docs/liteparse/guides/library-usage.mdnew file mode 100644index 0000000..c9701cb--- /dev/null+++ b/docs/src/content/docs/liteparse/guides/library-usage.md@@ -0,0 +1,165 @@+---+title: Library Usage+description: Use LiteParse programmatically from TypeScript or Python.+sidebar:+ order: 1+---++LiteParse can be used as a library in your own code, not just from the CLI. There are packages for both TypeScript and Python.++## TypeScript++Install as a project dependency:++```bash+npm install @llamaindex/liteparse+# or+pnpm add @llamaindex/liteparse+```++### Parsing a document++```typescript+import { LiteParse } from "@llamaindex/liteparse";++const parser = new LiteParse({ ocrEnabled: true });+const result = await parser.parse("document.pdf");++// Full document text with layout preserved+console.log(result.text);++// Per-page data+for (const page of result.pages) {+ console.log(`Page ${page.pageNum}: ${page.textItems.length} text items`);+}+```++### JSON output with bounding boxes++```typescript+const parser = new LiteParse({ outputFormat: "json" });+const result = await parser.parse("document.pdf");++for (const page of result.json.pages) {+ for (const bbox of page.boundingBoxes) {+ console.log(`[${bbox.x1}, ${bbox.y1}] → [${bbox.x2}, ${bbox.y2}]`);+ }+}+```++### Configuration++Pass any config options to the constructor. You only need to specify what you want to override:++```typescript+const parser = new LiteParse({+ ocrEnabled: true,+ ocrServerUrl: "http://localhost:8828/ocr",+ ocrLanguage: "fra",+ dpi: 300,+ outputFormat: "json",+ targetPages: "1-10",+});+```++### Screenshots++Generate page images as buffers — useful for sending to LLMs or saving to disk:++```typescript+const parser = new LiteParse();+const screenshots = await parser.screenshot("document.pdf");++for (const shot of screenshots) {+ console.log(`Page ${shot.pageNum}: ${shot.width}x${shot.height}`);+ // shot.imageBuffer contains the raw PNG/JPG data+}+```++See the [API reference](/liteparse/api/) for full type details.++---++## Python++The Python package wraps the LiteParse CLI, so the Node.js CLI must be installed first.++### Installation++```bash+# 1. Install the CLI (required)+npm install -g @llamaindex/liteparse++# 2. Install the Python package+pip install liteparse+```++<Aside type="caution">+ The Python package calls the LiteParse CLI under the hood. Make sure `lit` is available on your PATH before using the Python library.+</Aside>++### Parsing a document++```python+from liteparse import LiteParse++parser = LiteParse()+result = parser.parse("document.pdf")++# Full document text+print(result.text)++# Per-page data+for page in result.pages:+ print(f"Page {page.pageNum}: {len(page.textItems)} text items")+```++### Configuration++Options can be set on the constructor (applied to all parse calls) or per-call:++```python+# Constructor-level defaults+parser = LiteParse(+ ocr_enabled=True,+ ocr_server_url="http://localhost:8828/ocr",+ ocr_language="fra",+ dpi=300,+)++# Per-call options+result = parser.parse("document.pdf", target_pages="1-5")+```++### Parsing from bytes++If you already have file contents in memory (e.g. from a web upload):++```python+result = parser.parse_bytes(pdf_bytes, filename="upload.pdf")+print(result.text)+```++### Batch parsing++For multiple files, batch mode reuses the PDF engine and is significantly faster:++```python+result = parser.batch_parse(+ input_dir="./documents",+ output_dir="./output",+ recursive=True,+ extension_filter=".pdf",+)++print(f"Parsed {result.success_count} files in {result.total_time_seconds}s")+```++### Quick text extraction++If you just need the text and nothing else:++```python+text = parser.get_text("document.pdf")+print(text)+```diff --git a/docs/src/content/docs/liteparse/multi-format.md b/docs/src/content/docs/liteparse/guides/multi-format.mdsimilarity index 100%rename from docs/src/content/docs/liteparse/multi-format.mdrename to docs/src/content/docs/liteparse/guides/multi-format.mddiff --git a/docs/src/content/docs/liteparse/ocr.md b/docs/src/content/docs/liteparse/guides/ocr.mdsimilarity index 100%rename from docs/src/content/docs/liteparse/ocr.mdrename to docs/src/content/docs/liteparse/guides/ocr.mddiff --git a/docs/src/content/docs/liteparse/index.md b/docs/src/content/docs/liteparse/index.mdindex a9948f6..3c68ae6 100644--- a/docs/src/content/docs/liteparse/index.md+++ b/docs/src/content/docs/liteparse/index.md@@ -1,50 +1,26 @@----title: Getting Started-description: Install LiteParse and parse your first document in under a minute.+title: What is LiteParse?+description: Fast, local PDF parsing with spatial text extraction, OCR, and bounding boxes.sidebar:- order: 1+ order: 0----LiteParse is an open-source PDF parsing tool that parses text with spatial layout information and bounding boxes. It runs entirely on your machine, which means no cloud dependencies, no LLMs, no API keys.+LiteParse is an open-source document parsing library that extracts text with spatial layout information and bounding boxes. It runs entirely on your machine, with no cloud dependencies, no LLMs, no API keys.-## Installation+LiteParse is designed specifically for use cases that require fast, accurate text extraction: real-time applications, coding agents, and local workflows. It provides a simple CLI and library API for parsing PDFs, Office documents, and images, with built-in OCR support.-```bash-# npm (recommended)-npm i -g @llamaindex/liteparse+## What can LiteParse do?-# brew (macOS/Linux)-brew tap run-llama/liteparse-brew install llamaindex-liteparse-```+- **Parse PDFs** with precise spatial layout. Text comes back positioned where it appears on the page+- **Extract bounding boxes** for every text line, ready for downstream processing or visualization+- **OCR scanned documents** using built-in Tesseract.js or plug in your own OCR server+- **Parse Office files and images** with support for DOCX, XLSX, PPTX, PNG, JPG, and more via automatic conversion+- **Screenshot PDF pages** as high-quality images for LLM-based workflows+- **Use from TypeScript, Python, or the CLI** — whatever fits your stack-## Quick start+## Get started-Once installed, you can start parsing immediately from the command line:--```bash-lit parse document.pdf--# Save output to a text file-lit parse document.pdf -o output.txt--# Get structured JSON with bounding boxes-lit parse document.pdf --format json -o output.json--# Parse only specific pages-lit parse document.pdf --target-pages "1-5,10,15-20"--# Parse an entire directory of PDFs into an output directory-lit batch-parse ./pdfs ./outputs--# Screenshot the pages of a PDF for LLM agents-lit screenshot document.pdf -o ./screenshots-```--## Next steps--- [OCR Servers](./ocr) — configure Tesseract, EasyOCR, PaddleOCR, or bring your own-- [Multi-format support](./multi-format) — parse DOCX, XLSX, PPTX, images, and more-- [Agent skill](./agent-skill) — use LiteParse as a coding agent skill-- [CLI reference](./cli-reference) — complete command and option reference-- [API reference](./api) — TypeScript library types and methods+- [Getting started](/liteparse/getting_started/): Install LiteParse and parse your first document.+- [Library usage](/liteparse/guides/library-usage/): Use LiteParse from TypeScript or Python code.+- [CLI reference](/liteparse/cli-reference/): Complete command and option reference.+- [API reference](/liteparse/api/): TypeScript library types and methods.