Skip to content

/xberg-picking-a-format

Use when choosing an output format for extracted documents — plain text, markdown, djot, HTML, JSON, or DocTags. Maps consumer (LLM, parser, archive) to the right `--format` / `--content-format` pair.

From plugin
xberg
9.6k7 skills2 commands1 MCP

Claude Code

$ npx -y skills add xberg-io/xberg --skill xberg-picking-a-format --agent claude-code

SKILL.md

xberg-picking-a-format.SKILL.md
description: Use when choosing an output format for extracted documents — plain text, markdown, djot, HTML, JSON, or DocTags. Maps consumer (LLM, parser, archive) to the right `--format` / `--content-format` pair.
name: xberg-picking-a-format

<!-- AI-RULEZ :: GENERATED FILE — DO NOT EDIT Content-Hash: blake3:a2f204c34c2eb303812f0b7b0a9acf29c879edd1985b8cc3312555b347378e1e Source-Hash: blake3:349da3cd7af45e537dbb8e8aa6b033a84afccc9dd0f9ad1552d37ae18780228d Schema-Version: v1 -->

Picking a format

Xberg has two orthogonal format knobs. Get them right up front and the downstream code stays simple.

| Knob | What it controls | Values | Default | | ------------------- | ------------------------------------------------- | -------------------------------------- | ---------------- | | `--format` | How the CLI prints the result | `text`, `json`, `toon` | `text` (`extract`), `json` (`batch`) | | `--content-format` | How extracted content is rendered inside `result` | `plain`, `markdown`, `djot`, `html`, `json`, `doctags` | `plain` | | `--token-reduction` | Strip whitespace / boilerplate for LLM contexts | `off`, `light`, `moderate`, `aggressive`, `maximum` | `off` |

`--format json` returns an envelope wrapping the `ExtractedDocument` — the document lives under `.result` for `extract` and under `.results[]` for `batch`, with `content`, `metadata`, `tables`, and `images` as fields of that nested document. `--format text` prints just `content`. `--content-format` is what shows up inside that `content` field.

Decision tree

Who consumes the output?
├── LLM (Claude, GPT, Gemini, local) — embed/prompt context
│       --format text --content-format markdown
├── Vector store / RAG indexer
│       --format json --content-format markdown
│       (markdown preserves structure for chunking)
├── Downstream parser that expects machine-readable JSON
│       --format json --content-format plain
│       (cleanest text + structured metadata)
├── Human review / archival
│       --format text --content-format markdown
├── HTML re-rendering / web display
│       --format json --content-format html
├── Lossless intermediate for pandoc / academic tooling
│       --format json --content-format djot
└── Token-budget-constrained pipeline
        --format text --content-format plain
        (drops markup; add --token-reduction moderate for further savings)

Examples

Feed a PDF directly into an LLM:

xberg extract paper.pdf --content-format markdown

Index a corpus into a RAG store with tables and headings preserved:

xberg batch docs/*.pdf --format json --content-format markdown \
  | jq -c '.result | {content: .content, tables: .tables}'

Strip a file to bare text for a token-tight summarizer:

xberg extract long.pdf \
  --content-format plain \
  --token-reduction moderate

Pull metadata only, ignore content:

xberg extract file.pdf --format json | jq '.result.metadata'

When in doubt

  • **Default to `markdown`** as the content format. It is the best

compromise across LLMs, RAG, and human review, and Xberg has the most faithful renderer for it.

  • Reach for `plain` only when downstream cannot tolerate any markup.
  • Reach for `djot` only if you're already in a djot/pandoc pipeline.
  • Reach for `html` only when re-rendering for the web.
  • Reach for `json` for a heading-driven content tree, or `doctags` for Docling-compatible output.

Token-reduction (orthogonal)

`--token-reduction` collapses whitespace, strips repeated headers/footers, and trims boilerplate. It composes with any `--content-format`:

  • `off` (default), `light`, `moderate`, `aggressive`, `maximum`.

Use `moderate` as a safe starting point for LLM context windows. `maximum` is lossy — verify before relying on it.

See `references/cli-reference.md` for the full flag set and `references/configuration.md` for the equivalent `output_format` and `token_reduction` keys in `xberg.toml`.

Read more
@xberg-io
Ships withxberg

The fast, precise document-intelligence engine — for every language. Point Xberg at anything — a PDF, a scanned image, a spreadsheet, an audio file, a URL, a whole archive, or a source tree — and get back clean text, tables, metadata, and structured data.

Stars on GitHub

Momentum

stars in total
9.6k
Star history of xberg-io/xberg on GitHub, a chart by star-history.com

Other skills on xberg.

xberg-batch-extraction
Auto-invoked

xberg-batch-extraction

Use when extracting from many files at once with shared config, bounded parallelism, per-file overrides, and error recovery.…

@xberg-io@xberg-ioInstall Skill
xberg-chunking
Auto-invoked

xberg-chunking

Use when splitting extracted text into chunks for LLM context windows or RAG ingestion. Covers chunk size, overlap,…

@xberg-io@xberg-ioInstall Skill
xberg-extracting-keywords
Auto-invoked

xberg-extracting-keywo…

Use when extracting keywords (YAKE/RAKE) from documents — and, secondarily, when detecting document language or generating…

@xberg-io@xberg-ioInstall Skill
xberg-extracting-tables
Auto-invoked

xberg-extracting-table…

Use when extracting tabular data from PDFs, spreadsheets, or images. Covers layout-aware table detection, table model selection,…

@xberg-io@xberg-ioInstall Skill
xberg-extracting-with-ocr
Auto-invoked

xberg-extracting-with-…

Use when extracting text from scanned PDFs, photographed pages, or images that have no embedded text layer. Covers OCR backends,…

@xberg-io@xberg-ioInstall Skill
xberg
Auto-invoked

xberg

Extract text, tables, metadata, and images from 107 document formats (PDF, Office, images, HTML, email, archives, academic) using…

@xberg-io@xberg-ioInstall Skill

More skills from other plugins.

paddleocr-doc-parsing

paddleocr-doc-parsing

Use this skill to extract structured Markdown/JSON from PDFs and document images—tables with cell-level precision, formulas as…

paddleocr2mo93k
@paddlepaddle@paddlepaddleInstall Skill
context-loader
Auto-invoked

context-loader

Search memories from earlier Pi sessions in this repository. Use it when earlier work may already explain the code, error,…

mem02w69k
@mem0ai@mem0aiInstall Skill
analyzing-ai-citations

analyzing-ai-citations

Answer AI citation and answer engine optimization (AEO) questions in PostHog: whether AI answer engines (ChatGPT, Claude, and an…

posthog3w41k
@posthog@posthogInstall Skill

Questions about xberg-picking-a-format.

Which coding agents can use xberg-picking-a-format?
xberg-picking-a-format installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.