Skip to content

A fast, helpful, and open-source document parser

update docs with new output format

Logan Markewichd5f1d792aa7e
diff --git a/README.md b/README.md
index 79d64c0..03f86bb 100644
--- a/README.md
+++ b/README.md
@@ -38,7 +38,8 @@ hard stuff so your models see clean, structured data and markdown.
- **HTTP Servers**: Plug in any OCR server (EasyOCR, PaddleOCR, custom)
- **Standard API**: Simple, well-defined OCR API specification
- **Screenshot Generation**: Generate high-quality page screenshots for LLM agents
-- **Multiple Output Formats**: JSON and Text
+- **Multiple Output Formats**: Markdown, JSON, and Text
+- **Markdown Output**: Structured Markdown with headings, tables, lists, images, and links — great for feeding LLMs and RAG pipelines
- **Bounding Boxes**: Precise text positioning information
- **Multi-language**: Use from Rust, Node.js/TypeScript, Python, or the browser (WASM)
- **Multi-platform**: Linux, macOS (Intel/ARM), Windows
@@ -145,6 +146,9 @@ The CLI is the same across all installations (`npm`, `pip`, `cargo install`).
# Basic parsing
lit parse document.pdf
+# Parse to Markdown — headings, tables, lists, images, links
+lit parse document.pdf --format markdown -o output.md
+
# Parse with specific format
lit parse document.pdf --format json -o output.json
@@ -158,6 +162,40 @@ lit parse document.pdf --no-ocr
curl -sL https://example.com/report.pdf | lit parse -
```
+### Markdown Output
+
+LiteParse can render documents directly to Markdown. This means reconstructing headings,
+tables, lists, images, and links from the spatial layout. This is ideal for
+feeding documents to LLMs and RAG pipelines. This mode is purely heuristics and rule-based,
+so complex documents may not render perfectly, but it will be fast.
+
+```bash
+# Render to Markdown
+lit parse document.pdf --format markdown -o output.md
+
+# Strip images instead of emitting placeholders
+lit parse document.pdf --format markdown --image-mode off
+
+# Extract embedded images to disk and reference them from the markdown
+lit parse document.pdf --format markdown --image-mode embed --image-output-dir ./images
+
+# Emit link text as plain text (no [text](url) syntax)
+lit parse document.pdf --format markdown --no-links
+```
+
+Image handling is controlled by `--image-mode`:
+
+| Mode | Behavior |
+|------|----------|
+| `placeholder` (default) | Emits `![](image_pN_K.png)` references in reading order |
+| `off` | Strips images entirely |
+| `embed` | Writes each image's PNG bytes to `--image-output-dir` and references them |
+
+> Markdown reconstruction quality varies with document complexity. For the
+> hardest documents (dense tables, multi-column layouts, scans),
+> [LlamaParse](https://developers.llamaindex.ai/python/cloud/llamaparse/?utm_source=github&utm_medium=liteparse)
+> remains the most accurate option.
+
### Batch Parsing
Parse an entire directory of documents:
@@ -190,7 +228,7 @@ lit parse [OPTIONS] <file>
Options:
-o, --output <file> Output file path
- --format <format> Output format: json|text [default: text]
+ --format <format> Output format: json|text|markdown [default: text]
--no-ocr Disable OCR
--ocr-language <lang> OCR language, Tesseract format [default: eng]
--ocr-server-url <url> HTTP OCR server URL (uses Tesseract if not provided)
@@ -198,6 +236,9 @@ Options:
--max-pages <n> Max pages to parse [default: 1000]
--target-pages <pages> Pages to parse (e.g., "1-5,10,15-20")
--dpi <dpi> Rendering DPI [default: 150]
+ --image-mode <mode> Markdown image handling: off|placeholder|embed [default: placeholder]
+ --image-output-dir <dir> Where to write images when --image-mode embed
+ --no-links Emit link anchor text as plain text (no [text](url)) in markdown
--preserve-small-text Keep very small text
--password <password> Password for encrypted documents
--num-workers <n> Concurrent OCR workers [default: CPU cores - 1]
@@ -211,7 +252,7 @@ Options:
lit batch-parse [OPTIONS] <input-dir> <output-dir>
Options:
- --format <format> Output format: json|text [default: text]
+ --format <format> Output format: json|text|markdown [default: text]
--no-ocr Disable OCR
--ocr-language <lang> OCR language [default: eng]
--ocr-server-url <url> HTTP OCR server URL
diff --git a/crates/liteparse/README.md b/crates/liteparse/README.md
index a95fddd..342fa71 100644
--- a/crates/liteparse/README.md
+++ b/crates/liteparse/README.md
@@ -55,7 +55,7 @@ let config = LiteParseConfig {
max_pages: 1000, // Max pages to parse
target_pages: Some("1-5,10".into()), // Specific pages (optional)
dpi: 150.0, // Rendering DPI
- output_format: OutputFormat::Json, // Output format
+ output_format: OutputFormat::Json, // Json | Text | Markdown
preserve_very_small_text: false, // Keep tiny text
password: None, // Password for protected documents
quiet: false, // Suppress progress output
@@ -65,6 +65,33 @@ let config = LiteParseConfig {
let parser = LiteParse::new(config);
```
+## Markdown Output
+
+LiteParse can render documents directly to Markdown, including headings, tables, lists,
+images, and links reconstructed from the spatial layout. Set
+`output_format: OutputFormat::Markdown`; the rendered Markdown is returned on
+`result.text`. Two related knobs control Markdown rendering:
+
+- `image_mode` (`ImageMode::Placeholder` default | `Off` | `Embed`) — how raster
+ images are surfaced in the output.
+- `extract_links` (default `true`) — render hyperlink annotations as
+ `[text](url)`; set `false` for plain anchor text.
+
+```rust
+use liteparse::config::{ImageMode, LiteParseConfig, OutputFormat};
+
+let config = LiteParseConfig {
+ output_format: OutputFormat::Markdown,
+ image_mode: ImageMode::Placeholder,
+ extract_links: true,
+ ..Default::default()
+};
+let result = LiteParse::new(config).parse("document.pdf").await?;
+println!("{}", result.text); // rendered Markdown
+```
+
+> Reconstruction quality varies with document complexity.
+
## Parsing from Bytes
```rust
@@ -105,6 +132,7 @@ The crate also builds the `lit` CLI binary:
```bash
lit parse document.pdf
lit parse document.pdf --format json -o output.json
+lit parse document.pdf --format markdown -o output.md
lit screenshot document.pdf -o ./screenshots
lit batch-parse ./input ./output
```
diff --git a/docs/src/content/docs/liteparse/cli-reference.md b/docs/src/content/docs/liteparse/cli-reference.md
index a05ac7d..fc9182f 100644
--- a/docs/src/content/docs/liteparse/cli-reference.md
+++ b/docs/src/content/docs/liteparse/cli-reference.md
@@ -26,7 +26,10 @@ lit parse [options] <file>
| Option | Description | Default |
|--------|-------------|---------|
| `-o, --output <file>` | Write output to a file instead of stdout | — |
-| `--format <format>` | Output format: `json` or `text` | `text` |
+| `--format <format>` | Output format: `json`, `text`, or `markdown` | `text` |
+| `--image-mode <mode>` | Markdown image handling: `off`, `placeholder`, or `embed` | `placeholder` |
+| `--image-output-dir <dir>` | Directory to write images to when `--image-mode embed` | — |
+| `--no-links` | Emit link anchor text as plain text (no `[text](url)`) in markdown | — |
| `--no-ocr` | Disable OCR entirely | — |
| `--ocr-language <lang>` | OCR language code (Tesseract format) | `eng` |
| `--ocr-server-url <url>` | HTTP OCR server URL | — (uses Tesseract) |
@@ -48,6 +51,12 @@ lit parse report.pdf
# JSON output with bounding boxes
lit parse report.pdf --format json -o report.json
+# Markdown output (headings, tables, lists, images, links)
+lit parse report.pdf --format markdown -o report.md
+
+# Markdown with embedded images written to disk
+lit parse report.pdf --format markdown --image-mode embed --image-output-dir ./images
+
# Parse pages 1-5 only, no OCR
lit parse report.pdf --target-pages "1-5" --no-ocr
@@ -85,7 +94,7 @@ lit batch-parse [options] <input-dir> <output-dir>
| Option | Description | Default |
|--------|-------------|---------|
-| `--format <format>` | Output format: `json` or `text` | `text` |
+| `--format <format>` | Output format: `json`, `text`, or `markdown` | `text` |
| `--no-ocr` | Disable OCR entirely | — |
| `--ocr-language <lang>` | OCR language code | `eng` |
| `--ocr-server-url <url>` | HTTP OCR server URL | — (uses Tesseract) |
diff --git a/docs/src/content/docs/liteparse/getting_started.mdx b/docs/src/content/docs/liteparse/getting_started.mdx
index b1076e1..ba9ea5b 100644
--- a/docs/src/content/docs/liteparse/getting_started.mdx
+++ b/docs/src/content/docs/liteparse/getting_started.mdx
@@ -58,6 +58,9 @@ lit parse document.pdf -o output.txt
# Get structured JSON with bounding boxes
lit parse document.pdf --format json -o output.json
+# Render to Markdown (headings, tables, lists, images, links)
+lit parse document.pdf --format markdown -o output.md
+
# Parse only specific pages
lit parse document.pdf --target-pages "1-5,10,15-20"
```
@@ -80,6 +83,7 @@ lit screenshot document.pdf -o ./screenshots
## Next steps
+- [Markdown output](/liteparse/guides/markdown/): Render documents to clean, structured Markdown.
- [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.
diff --git a/docs/src/content/docs/liteparse/guides/agent-skill.md b/docs/src/content/docs/liteparse/guides/agent-skill.md
index 2337360..8f63f05 100644
--- a/docs/src/content/docs/liteparse/guides/agent-skill.md
+++ b/docs/src/content/docs/liteparse/guides/agent-skill.md
@@ -2,7 +2,7 @@
title: Agent Skill
description: Add LiteParse as a skill for coding agents like Claude Code, Cursor, and others.
sidebar:
- order: 6
+ order: 7
---
LiteParse can be installed as a **coding agent skill** using Vercel's [skills](https://github.com/vercel-labs/skills) utility. This gives your coding agent the ability to process documents, generate screenshots, and parse text from files, all locally.
diff --git a/docs/src/content/docs/liteparse/guides/browser-usage.md b/docs/src/content/docs/liteparse/guides/browser-usage.md
index de53be9..fa32459 100644
--- a/docs/src/content/docs/liteparse/guides/browser-usage.md
+++ b/docs/src/content/docs/liteparse/guides/browser-usage.md
@@ -2,7 +2,7 @@
title: Browser Usage (WASM)
description: Run LiteParse entirely in the browser with the WASM package.
sidebar:
- order: 6
+ order: 7
---
LiteParse ships a WebAssembly package that runs entirely in the browser — no server, no cloud calls. It supports PDF parsing and custom OCR engines implemented in JavaScript.
diff --git a/docs/src/content/docs/liteparse/guides/library-usage.mdx b/docs/src/content/docs/liteparse/guides/library-usage.mdx
index f1dfdac..e4aca4c 100644
--- a/docs/src/content/docs/liteparse/guides/library-usage.mdx
+++ b/docs/src/content/docs/liteparse/guides/library-usage.mdx
@@ -53,6 +53,20 @@ for (const page of result.pages) {
}
```
+### Markdown output
+
+Render the document to Markdown — headings, tables, lists, images, and links. The rendered Markdown comes back on `result.text`:
+
+```typescript
+const parser = new LiteParse({
+ outputFormat: "markdown", // "json" | "text" | "markdown"
+ imageMode: "placeholder", // "placeholder" | "off" | "embed"
+ extractLinks: true, // render [text](url) link syntax (default: true)
+});
+const result = await parser.parse("document.pdf");
+console.log(result.text); // rendered Markdown
+```
+
### Configuration
Pass any config options to the constructor. You only need to specify what you want to override:
@@ -154,6 +168,20 @@ parser = LiteParse(
result = parser.parse("document.pdf")
```
+### Markdown output
+
+Render the document to Markdown — headings, tables, lists, images, and links. The rendered Markdown comes back on `result.text`:
+
+```python
+parser = LiteParse(
+ output_format="markdown", # "json" | "text" | "markdown"
+ image_mode="placeholder", # "placeholder" | "off" | "embed"
+ extract_links=True, # render [text](url) link syntax (default: True)
+)
+result = parser.parse("document.pdf")
+print(result.text) # rendered Markdown
+```
+
### Parsing from bytes
If you already have file contents in memory (e.g. from a web upload), pass them directly to `parse()`:
@@ -246,6 +274,24 @@ let config = LiteParseConfig {
let parser = LiteParse::new(config);
```
+### Markdown output
+
+Render the document to Markdown — headings, tables, lists, images, and links. The rendered Markdown comes back on `result.text`:
+
+```rust
+use liteparse::config::{ImageMode, LiteParseConfig, OutputFormat};
+use liteparse::LiteParse;
+
+let config = LiteParseConfig {
+ output_format: OutputFormat::Markdown,
+ image_mode: ImageMode::Placeholder,
+ extract_links: true,
+ ..Default::default()
+};
+let result = LiteParse::new(config).parse("document.pdf").await?;
+println!("{}", result.text); // rendered Markdown
+```
+
### Screenshots
Generate page images as PNG bytes:
@@ -328,6 +374,16 @@ const parser = new LiteParse({
});
```
+### Markdown output
+
+The browser build supports Markdown output too — set `outputFormat: "markdown"` and read the rendered Markdown from `result.text`. See the [Markdown output guide](/liteparse/guides/markdown/) for the `imageMode` and `extractLinks` options.
+
+```typescript
+const parser = new LiteParse({ outputFormat: "markdown" });
+const result = await parser.parse(bytes);
+console.log(result.text); // rendered Markdown
+```
+
### OCR in the browser
The native Tesseract and HTTP OCR backends are not available in the browser. To use OCR, provide a JS-side engine with a `recognize` method:
diff --git a/docs/src/content/docs/liteparse/guides/multi-format.md b/docs/src/content/docs/liteparse/guides/multi-format.md
index 1a816c0..acdd058 100644
--- a/docs/src/content/docs/liteparse/guides/multi-format.md
+++ b/docs/src/content/docs/liteparse/guides/multi-format.md
@@ -2,7 +2,7 @@
title: Multi-Format Support
description: Parse Word documents, spreadsheets, presentations, and images with LiteParse.
sidebar:
- order: 3
+ order: 4
---
LiteParse automatically converts non-PDF formats to PDF before parsing. This lets you use the same parsing pipeline for Office documents, images, and more.
diff --git a/docs/src/content/docs/liteparse/guides/ocr.md b/docs/src/content/docs/liteparse/guides/ocr.md
index 297ba50..53d6045 100644
--- a/docs/src/content/docs/liteparse/guides/ocr.md
+++ b/docs/src/content/docs/liteparse/guides/ocr.md
@@ -2,7 +2,7 @@
title: OCR Configuration
description: Configure OCR in LiteParse — built-in Tesseract, or bring your own via HTTP servers.
sidebar:
- order: 2
+ order: 3
---
LiteParse uses OCR selectively — only on embedded images or pages where native text extraction didn't find text. This keeps parsing fast while still capturing text from scanned pages and embedded images.
diff --git a/docs/src/content/docs/liteparse/guides/parsing-urls.md b/docs/src/content/docs/liteparse/guides/parsing-urls.md
index 47048a3..14a2f8c 100644
--- a/docs/src/content/docs/liteparse/guides/parsing-urls.md
+++ b/docs/src/content/docs/liteparse/guides/parsing-urls.md
@@ -2,7 +2,7 @@
title: Parsing URLs
description: Parse remote documents by reading URLs.
sidebar:
- order: 5
+ order: 6
---
To parse remote files, LiteParse supports both CLI and library usage for reading bytes and streams. The CLI can download them with any tool you like and pipe the bytes to `lit parse` using `-` as the file argument, while the libraries can fetch the bytes directly and pass them to the parser.
diff --git a/docs/src/content/docs/liteparse/guides/server-usage.md b/docs/src/content/docs/liteparse/guides/server-usage.md
index 8a32385..ba97215 100644
--- a/docs/src/content/docs/liteparse/guides/server-usage.md
+++ b/docs/src/content/docs/liteparse/guides/server-usage.md
@@ -2,7 +2,7 @@
title: Server Usage
description: Run LiteParse as an HTTP service with liteparse-server.
sidebar:
- order: 7
+ order: 8
---
[`liteparse-server`](https://github.com/run-llama/liteparse-server) is an Express server that exposes [`@llamaindex/liteparse`](https://www.npmjs.com/package/@llamaindex/liteparse) as an HTTP parsing backend. It lets you run LiteParse as a standalone service, which is useful when your application isn't Node.js, when you want to share one parsing instance across multiple clients, or when you need a parsing endpoint behind your own infrastructure.
diff --git a/docs/src/content/docs/liteparse/guides/visual-citations.mdx b/docs/src/content/docs/liteparse/guides/visual-citations.mdx
index 2936951..506dff7 100644
--- a/docs/src/content/docs/liteparse/guides/visual-citations.mdx
+++ b/docs/src/content/docs/liteparse/guides/visual-citations.mdx
@@ -2,7 +2,7 @@
title: Visual Citations with Bounding Boxes
description: Use bounding boxes and screenshots to show exactly where information was found in a document.
sidebar:
- order: 4
+ order: 5
---
When building agents or RAG workflows, it is often not enough to parse text and call it done. Frequently, users and applications will require you to show _where_ that text came from.
diff --git a/docs/src/content/docs/liteparse/index.md b/docs/src/content/docs/liteparse/index.md
index 6b9a2c1..a466481 100644
--- a/docs/src/content/docs/liteparse/index.md
+++ b/docs/src/content/docs/liteparse/index.md
@@ -14,6 +14,7 @@ LiteParse is designed specifically for use cases that require fast, accurate tex
## What can LiteParse do?
- **Parse PDFs** with precise spatial layout. Text comes back positioned where it appears on the page
+- **Render to Markdown** with headings, tables, lists, images, and links — clean structured output for LLMs and RAG pipelines
- **Extract bounding boxes** for every text line, ready for downstream processing or visualization
- **OCR scanned documents** using built-in Tesseract 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
@@ -23,6 +24,7 @@ LiteParse is designed specifically for use cases that require fast, accurate tex
## Get started
- [Getting started](/liteparse/getting_started/): Install LiteParse and parse your first document.
+- [Markdown output](/liteparse/guides/markdown/): Render documents to clean, structured Markdown.
- [Library usage](/liteparse/guides/library-usage/): Use LiteParse from TypeScript or Python code.
- [Browser usage (WASM)](/liteparse/guides/browser-usage/): Run LiteParse in the browser with zero server dependencies.
- [CLI reference](/liteparse/cli-reference/): Complete command and option reference.
diff --git a/packages/node/README.md b/packages/node/README.md
index ed6f9d4..271e9c6 100644
--- a/packages/node/README.md
+++ b/packages/node/README.md
@@ -25,6 +25,24 @@ for (const page of result.pages) {
}
```
+## Markdown Output
+
+LiteParse can render documents directly to Markdown including headings, tables, lists,
+images, and links reconstructed from the spatial layout. Great for feeding LLMs
+and RAG pipelines. The rendered Markdown is returned on `result.text`:
+
+```typescript
+const parser = new LiteParse({
+ outputFormat: 'markdown', // "json" | "text" | "markdown"
+ imageMode: 'placeholder', // "placeholder" | "off" | "embed"
+ extractLinks: true, // render [text](url) link syntax (default: true)
+});
+const result = await parser.parse('document.pdf');
+console.log(result.text); // rendered Markdown
+```
+
+> Reconstruction quality varies with document complexity.
+
## Configuration
All options are passed to the constructor:
@@ -38,6 +56,9 @@ const parser = new LiteParse({
maxPages: 1000, // Max pages to parse
targetPages: '1-5,10', // Specific pages (optional)
dpi: 150, // Rendering DPI
+ outputFormat: 'json', // "json" | "text" | "markdown"
+ imageMode: 'placeholder', // Markdown image handling: "placeholder" | "off" | "embed"
+ extractLinks: true, // Render [text](url) links in markdown output
preserveVerySmallText: false, // Keep tiny text
password: undefined, // Password for protected documents
quiet: false, // Suppress progress output
diff --git a/packages/python/README.md b/packages/python/README.md
index c155039..c938cee 100644
--- a/packages/python/README.md
+++ b/packages/python/README.md
@@ -24,6 +24,24 @@ for page in result.pages:
print(f"Page {page.page_num}: {len(page.text_items)} text items")
```
+## Markdown Output
+
+LiteParse can render documents directly to Markdown including headings, tables, lists,
+images, and links reconstructed from the spatial layout. Great for feeding LLMs
+and RAG pipelines. The rendered Markdown is returned on `result.text`:
+
+```python
+parser = LiteParse(
+ output_format="markdown", # "json" | "text" | "markdown"
+ image_mode="placeholder", # "placeholder" | "off" | "embed"
+ extract_links=True, # render [text](url) link syntax (default: True)
+)
+result = parser.parse("document.pdf")
+print(result.text) # rendered Markdown
+```
+
+> Reconstruction quality varies with document complexity.
+
## Configuration
All options are passed to the constructor:
@@ -37,6 +55,9 @@ parser = LiteParse(
max_pages=1000, # Max pages to parse
target_pages="1-5,10", # Specific pages (optional)
dpi=150, # Rendering DPI
+ output_format="json", # "json" | "text" | "markdown"
+ image_mode="placeholder", # Markdown image handling: "placeholder" | "off" | "embed"
+ extract_links=True, # Render [text](url) links in markdown output
preserve_very_small_text=False, # Keep tiny text
password=None, # Password for protected documents
quiet=False, # Suppress progress output
diff --git a/packages/wasm/README.md b/packages/wasm/README.md
index 07f744e..3ed4221 100644
--- a/packages/wasm/README.md
+++ b/packages/wasm/README.md
@@ -42,7 +42,9 @@ All optional, camelCase:
| `maxPages` | `number` | `1000` | Stop after this many pages |
| `targetPages` | `string` | — | e.g. `"1-5,10,15-20"` |
| `dpi` | `number` | `150` | Render DPI for OCR / screenshots |
-| `outputFormat` | `"json" \| "text"` | `"json"` | Format used by `parser.format(...)` |
+| `outputFormat` | `"json" \| "text" \| "markdown"` | `"json"` | Output format; `"markdown"` returns rendered Markdown on `result.text` |
+| `imageMode` | `"off" \| "placeholder" \| "embed"` | `"placeholder"` | How raster images are surfaced in markdown output |
+| `extractLinks` | `boolean` | `true` | Render hyperlink annotations as `[text](url)` in markdown output |
| `preserveVerySmallText` | `boolean` | `false` | Keep tiny text that's normally filtered |
| `password` | `string` | — | Password for protected PDFs |
| `quiet` | `boolean` | `false` | Suppress progress logging |