{"data":{"slug":"github-xberg-io-xberg-plugin-cursor-plugin-skills-xberg-picking-a-format-c5dd83561906","title":"Choosing the Right Output Format for Extracted Documents","summary":"Select the optimal format for extracted documents based on the downstream consumer (LLM, parser, archive) to ensure compatibility and efficiency.","url":"https:\/\/skillshunter.net\/skills\/github-xberg-io-xberg-plugin-cursor-plugin-skills-xberg-picking-a-format-c5dd83561906","json_url":"https:\/\/skillshunter.net\/api\/public\/v1\/skills\/github-xberg-io-xberg-plugin-cursor-plugin-skills-xberg-picking-a-format-c5dd83561906","markdown_url":"https:\/\/skillshunter.net\/skills\/github-xberg-io-xberg-plugin-cursor-plugin-skills-xberg-picking-a-format-c5dd83561906.md","download_url":"https:\/\/skillshunter.net\/skills\/github-xberg-io-xberg-plugin-cursor-plugin-skills-xberg-picking-a-format-c5dd83561906\/download","category":{"slug":"software-development","name":"Software & Development"},"editor_note":"The skill requires understanding the downstream consumer's needs, such as an LLM, parser, or archive, to choose between formats like text, markdown, JSON, or others. The default content format is markdown, which is recommended for most use cases.","instructions":"---\ndescription: Use when choosing an output format for extracted documents \u2014 plain text, markdown, djot, HTML, JSON, or DocTags. Maps consumer (LLM, parser, archive) to the right `--format` \/ `--content-format` pair.\nname: xberg-picking-a-format\n---\n\n<!--\nAI-RULEZ :: GENERATED FILE \u2014 DO NOT EDIT\nContent-Hash: blake3:a2f204c34c2eb303812f0b7b0a9acf29c879edd1985b8cc3312555b347378e1e\nSource-Hash: blake3:ab2bcd453f9c2ded67752f6a9800186d42b6921f4be16f6ab3a773254a9fba00\nSchema-Version: v1\n-->\n\n# Picking a format\n\nXberg has two orthogonal format knobs. Get them right up front and the\ndownstream code stays simple.\n\n| Knob                | What it controls                                  | Values                                 | Default          |\n| ------------------- | ------------------------------------------------- | -------------------------------------- | ---------------- |\n| `--format`          | How the CLI prints the result                     | `text`, `json`, `toon`                 | `text` (`extract`), `json` (`batch`) |\n| `--content-format`  | How extracted content is rendered inside `result` | `plain`, `markdown`, `djot`, `html`, `json`, `doctags` | `plain`     |\n| `--token-reduction` | Strip whitespace \/ boilerplate for LLM contexts   | `off`, `light`, `moderate`, `aggressive`, `maximum` | `off`  |\n\n`--format json` returns an envelope wrapping the `ExtractedDocument` \u2014 the\ndocument lives under `.result` for `extract` and under `.results[]` for\n`batch`, with `content`, `metadata`, `tables`, and `images` as fields of\nthat nested document. `--format text` prints just `content`.\n`--content-format` is what shows up inside that `content` field.\n\n## Decision tree\n\n```text\nWho consumes the output?\n\u251c\u2500\u2500 LLM (Claude, GPT, Gemini, local) \u2014 embed\/prompt context\n\u2502       --format text --content-format markdown\n\u251c\u2500\u2500 Vector store \/ RAG indexer\n\u2502       --format json --content-format markdown\n\u2502       (markdown preserves structure for chunking)\n\u251c\u2500\u2500 Downstream parser that expects machine-readable JSON\n\u2502       --format json --content-format plain\n\u2502       (cleanest text + structured metadata)\n\u251c\u2500\u2500 Human review \/ archival\n\u2502       --format text --content-format markdown\n\u251c\u2500\u2500 HTML re-rendering \/ web display\n\u2502       --format json --content-format html\n\u251c\u2500\u2500 Lossless intermediate for pandoc \/ academic tooling\n\u2502       --format json --content-format djot\n\u2514\u2500\u2500 Token-budget-constrained pipeline\n        --format text --content-format plain\n        (drops markup; add --token-reduction moderate for further savings)\n```\n\n## Examples\n\nFeed a PDF directly into an LLM:\n\n```bash\nxberg extract paper.pdf --content-format markdown\n```\n\nIndex a corpus into a RAG store with tables and headings preserved:\n\n```bash\nxberg batch docs\/*.pdf --format json --content-format markdown \\\n  | jq -c '.result | {content: .content, tables: .tables}'\n```\n\nStrip a file to bare text for a token-tight summarizer:\n\n```bash\nxberg extract long.pdf \\\n  --content-format plain \\\n  --token-reduction moderate\n```\n\nPull metadata only, ignore content:\n\n```bash\nxberg extract file.pdf --format json | jq '.result.metadata'\n```\n\n## When in doubt\n\n- **Default to `markdown`** as the content format. It is the best\n  compromise across LLMs, RAG, and human review, and Xberg has the\n  most faithful renderer for it.\n- Reach for `plain` only when downstream cannot tolerate any markup.\n- Reach for `djot` only if you're already in a djot\/pandoc pipeline.\n- Reach for `html` only when re-rendering for the web.\n- Reach for `json` for a heading-driven content tree, or `doctags` for Docling-compatible output.\n\n## Token-reduction (orthogonal)\n\n`--token-reduction` collapses whitespace, strips repeated headers\/footers,\nand trims boilerplate. It composes with any `--content-format`:\n\n- `off` (default), `light`, `moderate`, `aggressive`, `maximum`.\n\nUse `moderate` as a safe starting point for LLM context windows. `maximum`\nis lossy \u2014 verify before relying on it.\n\nSee `references\/cli-reference.md` for the full flag set and\n`references\/configuration.md` for the equivalent `output_format` and\n`token_reduction` keys in `xberg.toml`.\n","use_cases":["Feed a PDF directly into an LLM for context embedding","Index a corpus into a RAG store with structure preservation","Strip a file to bare text for a token-tight summarizer","Extract metadata only for archival or analysis"],"limitations":[],"compatibility":[],"setup_tip":null,"sample_input":null,"sample_output":null,"source_url":"https:\/\/github.com\/xberg-io\/xberg\/blob\/ffbf7971796a126fc52f6bb8fb40418772071f61\/plugin\/.cursor-plugin\/skills\/xberg-picking-a-format\/SKILL.md","source_commit":"ffbf7971796a126fc52f6bb8fb40418772071f61","license":null,"version":null,"listing_approved_at":"2026-11-16","created_at":"2026-11-15T14:44:21.000000Z","updated_at":"2026-11-16T05:17:13.000000Z","seo_title":"Choosing the Right Output Format for Extracted Documents","seo_description":"Select the best format for extracted documents based on the downstream consumer. Choose between text, markdown, JSON, and more for optimal results.","seo_keywords":["choosing output format for extracted documents","format selection for document extraction","LLM compatible document format","RAG store document formatting","token-efficient document output"]}}