@xberg-io/opencode-xberg 1.3.6 → 1.3.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/.opencode/ai-rulez-bundle.json +51 -0
  2. package/.opencode/ai-rulez-content.js +167 -0
  3. package/.opencode/commands/xberg-extract.md +14 -0
  4. package/.opencode/commands/xberg-ocr.md +14 -0
  5. package/.opencode/plugins/xberg.js +75 -62
  6. package/.opencode/skills/batch-extraction/SKILL.md +168 -0
  7. package/.opencode/skills/chunking/SKILL.md +163 -0
  8. package/.opencode/skills/extracting-keywords/SKILL.md +171 -0
  9. package/.opencode/skills/extracting-tables/SKILL.md +156 -0
  10. package/.opencode/skills/extracting-with-ocr/SKILL.md +130 -0
  11. package/.opencode/skills/picking-a-format/SKILL.md +104 -0
  12. package/.opencode/skills/xberg/SKILL.md +427 -0
  13. package/.opencode/skills/xberg/references/advanced-features.md +628 -0
  14. package/.opencode/skills/xberg/references/cli-reference.md +462 -0
  15. package/.opencode/skills/xberg/references/configuration.md +587 -0
  16. package/.opencode/skills/xberg/references/nodejs-api.md +485 -0
  17. package/.opencode/skills/xberg/references/other-bindings.md +345 -0
  18. package/.opencode/skills/xberg/references/python-api.md +657 -0
  19. package/.opencode/skills/xberg/references/rust-api.md +412 -0
  20. package/.opencode/skills/xberg/references/supported-formats.md +252 -0
  21. package/.pi/prompts/xberg-extract.md +14 -0
  22. package/.pi/prompts/xberg-ocr.md +14 -0
  23. package/.pi/skills/batch-extraction/SKILL.md +168 -0
  24. package/.pi/skills/chunking/SKILL.md +163 -0
  25. package/.pi/skills/extracting-keywords/SKILL.md +171 -0
  26. package/.pi/skills/extracting-tables/SKILL.md +156 -0
  27. package/.pi/skills/extracting-with-ocr/SKILL.md +130 -0
  28. package/.pi/skills/picking-a-format/SKILL.md +104 -0
  29. package/.pi/skills/xberg/SKILL.md +427 -0
  30. package/.pi/skills/xberg/references/advanced-features.md +628 -0
  31. package/.pi/skills/xberg/references/cli-reference.md +462 -0
  32. package/.pi/skills/xberg/references/configuration.md +587 -0
  33. package/.pi/skills/xberg/references/nodejs-api.md +485 -0
  34. package/.pi/skills/xberg/references/other-bindings.md +345 -0
  35. package/.pi/skills/xberg/references/python-api.md +657 -0
  36. package/.pi/skills/xberg/references/rust-api.md +412 -0
  37. package/.pi/skills/xberg/references/supported-formats.md +252 -0
  38. package/README.md +40 -0
  39. package/package.json +69 -16
  40. package/scripts/mcp-launch.sh +188 -0
@@ -0,0 +1,412 @@
1
+ <!--
2
+ AI-RULEZ :: GENERATED FILE — DO NOT EDIT
3
+ Content-Hash: blake3:a6ececeeda3031d9d84eb780fcb5ecb41b3f4297fa1e6b86f492e0d755b084a9
4
+ Source-Hash: blake3:3fca38eb564d0ed9c9194d070fd8dec96de727edc92e82954cb4b9af52cddbaf
5
+ Schema-Version: v1
6
+ -->
7
+
8
+ # Xberg Rust API Reference
9
+
10
+ Complete API reference for the Xberg document extraction library in Rust. Xberg is the Rust core that powers every language binding.
11
+
12
+ ## Setup
13
+
14
+ ```bash
15
+ cargo add xberg
16
+ ```
17
+
18
+ The crate version is `1.1.0`. Add it to `Cargo.toml`:
19
+
20
+ ```toml
21
+ [dependencies]
22
+ xberg = { version = "1.1.0", features = ["full"] }
23
+ tokio = { version = "1", features = ["full"] }
24
+ ```
25
+
26
+ `extract` / `extract_batch` are async and need a Tokio runtime, which you bring yourself (`#[tokio::main]` or an existing runtime).
27
+
28
+ ### Feature flags
29
+
30
+ The `tokio-runtime` feature is on by default. Capabilities are gated behind features:
31
+
32
+ | Feature | What it enables |
33
+ | -------------------- | --------------------------------------------------------- |
34
+ | `tokio-runtime` | Async runtime support (default). |
35
+ | `formats` | All document formats (no OCR/ML/api/mcp/chunking). |
36
+ | `full` | `formats` + ocr + layout + embeddings + tree-sitter + LLM. |
37
+ | `pdf` | PDF extraction. |
38
+ | `ocr` | Tesseract-based OCR. |
39
+ | `chunking` | Text chunking for RAG pipelines. |
40
+ | `embeddings` | ONNX embedding generation. |
41
+ | `language-detection` | Detect document language(s). |
42
+ | `keywords` | YAKE + RAKE keyword extraction. |
43
+ | `api` | HTTP API server (Axum). |
44
+ | `mcp` | Model Context Protocol server. |
45
+
46
+ ---
47
+
48
+ ## Core Extraction Functions
49
+
50
+ There are exactly two entry points. Both are `async`, take an [`ExtractInput`](#extractinput) and a `&ExtractionConfig`, and return an [`ExtractionResult`](#extractionresult-envelope) **envelope**.
51
+
52
+ ### `extract`
53
+
54
+ ```rust
55
+ pub async fn extract(input: ExtractInput, config: &ExtractionConfig) -> Result<ExtractionResult>
56
+ ```
57
+
58
+ ```rust
59
+ use xberg::{extract, ExtractInput, ExtractionConfig};
60
+
61
+ #[tokio::main]
62
+ async fn main() -> xberg::Result<()> {
63
+ let config = ExtractionConfig {
64
+ use_cache: true,
65
+ enable_quality_processing: true,
66
+ ..Default::default()
67
+ };
68
+
69
+ let output = extract(ExtractInput::from_uri("document.pdf"), &config).await?;
70
+ println!("{}", output.results[0].content);
71
+ println!("MIME type: {}", output.results[0].mime_type);
72
+ Ok(())
73
+ }
74
+ ```
75
+
76
+ ### `extract_batch`
77
+
78
+ ```rust
79
+ pub async fn extract_batch(inputs: Vec<ExtractInput>, config: &ExtractionConfig) -> Result<ExtractionResult>
80
+ ```
81
+
82
+ Extract multiple inputs in parallel. The returned envelope's `results` holds one `ExtractedDocument` per input (in input order), with non-fatal failures in `errors`.
83
+
84
+ ```rust
85
+ use xberg::{extract_batch, ExtractInput, ExtractionConfig};
86
+
87
+ #[tokio::main]
88
+ async fn main() -> xberg::Result<()> {
89
+ let config = ExtractionConfig::default();
90
+ let inputs = vec![
91
+ ExtractInput::from_uri("document.pdf"),
92
+ ExtractInput::from_bytes(
93
+ b"Hello from memory".to_vec(),
94
+ "text/plain",
95
+ Some("note.txt".to_string()),
96
+ ),
97
+ ];
98
+
99
+ let output = extract_batch(inputs, &config).await?;
100
+ for document in &output.results {
101
+ println!("{}", document.content);
102
+ }
103
+ Ok(())
104
+ }
105
+ ```
106
+
107
+ ---
108
+
109
+ ## ExtractInput
110
+
111
+ Unified input for both entry points.
112
+
113
+ ```rust
114
+ pub struct ExtractInput {
115
+ pub kind: ExtractInputKind, // Bytes | Uri
116
+ pub bytes: Option<Vec<u8>>, // for kind = Bytes
117
+ pub uri: Option<String>, // path, file:// URI, or HTTP(S) URL
118
+ pub mime_type: Option<String>, // MIME type hint
119
+ pub filename: Option<String>, // filename hint
120
+ pub config: Option<FileExtractionConfig>, // per-input overrides
121
+ }
122
+ ```
123
+
124
+ Constructors:
125
+
126
+ ```rust
127
+ // From a path, file:// URI, or URL
128
+ let input = ExtractInput::from_uri("document.pdf");
129
+
130
+ // From raw bytes (mime_type required, filename optional)
131
+ let input = ExtractInput::from_bytes(bytes.to_vec(), "application/pdf", Some("document.pdf".to_string()));
132
+ ```
133
+
134
+ ---
135
+
136
+ ## Configuration
137
+
138
+ ### `ExtractionConfig`
139
+
140
+ Construct with a struct literal and `..Default::default()`. Common fields:
141
+
142
+ ```rust
143
+ pub struct ExtractionConfig {
144
+ pub use_cache: bool, // default: true
145
+ pub enable_quality_processing: bool, // default: true
146
+ pub ocr: Option<OcrConfig>, // None = OCR disabled
147
+ pub force_ocr: bool, // default: false
148
+ pub chunking: Option<ChunkingConfig>, // None = disabled
149
+ pub images: Option<ImageExtractionConfig>,
150
+ pub pdf_options: Option<PdfConfig>,
151
+ pub token_reduction: Option<TokenReductionOptions>,
152
+ pub language_detection: Option<LanguageDetectionConfig>,
153
+ pub pages: Option<PageConfig>,
154
+ pub keywords: Option<KeywordConfig>,
155
+ pub postprocessor: Option<PostProcessorConfig>,
156
+ pub max_concurrent_extractions: Option<usize>,
157
+ pub result_format: ResultFormat, // Unified | ElementBased
158
+ pub output_format: OutputFormat, // Plain | Markdown | Djot | Html | Json | DocTags | Custom
159
+ pub security_limits: Option<SecurityLimits>,
160
+ // ... additional optional fields
161
+ }
162
+ ```
163
+
164
+ ```rust
165
+ use xberg::{extract, ChunkingConfig, ExtractionConfig, ExtractInput, OcrConfig, TesseractConfig};
166
+
167
+ #[tokio::main]
168
+ async fn main() -> xberg::Result<()> {
169
+ let config = ExtractionConfig {
170
+ use_cache: true,
171
+ ocr: Some(OcrConfig {
172
+ backend: "tesseract".to_string(),
173
+ language: vec!["eng".to_string(), "deu".to_string()],
174
+ tesseract_config: Some(TesseractConfig { psm: 6, ..Default::default() }),
175
+ ..Default::default()
176
+ }),
177
+ chunking: Some(ChunkingConfig {
178
+ max_characters: 1000,
179
+ overlap: 200,
180
+ ..Default::default()
181
+ }),
182
+ ..Default::default()
183
+ };
184
+
185
+ let output = extract(ExtractInput::from_uri("document.pdf"), &config).await?;
186
+ println!("Content length: {}", output.results[0].content.len());
187
+ Ok(())
188
+ }
189
+ ```
190
+
191
+ ### `OcrConfig`
192
+
193
+ ```rust
194
+ pub struct OcrConfig {
195
+ pub enabled: bool, // default: true
196
+ pub backend: String, // "tesseract", "paddleocr", "vlm"
197
+ pub language: Vec<String>, // ["eng"], ["eng", "fra"], ...
198
+ pub tesseract_config: Option<TesseractConfig>,
199
+ // ...
200
+ }
201
+ ```
202
+
203
+ ### `ChunkingConfig`
204
+
205
+ ```rust
206
+ pub struct ChunkingConfig {
207
+ pub max_characters: usize, // default: 1000
208
+ pub overlap: usize, // default: 200
209
+ pub trim: bool, // default: true
210
+ pub chunker_type: ChunkerType, // Text | Markdown | Semantic
211
+ pub embedding: Option<EmbeddingConfig>,
212
+ pub preset: Option<String>,
213
+ // ...
214
+ }
215
+ ```
216
+
217
+ The chunk-size fields are `max_characters` and `overlap`.
218
+
219
+ ```rust
220
+ use xberg::{extract, ChunkingConfig, ChunkerType, ExtractInput, ExtractionConfig};
221
+
222
+ let config = ExtractionConfig {
223
+ chunking: Some(ChunkingConfig {
224
+ max_characters: 512,
225
+ overlap: 50,
226
+ chunker_type: ChunkerType::Markdown,
227
+ ..Default::default()
228
+ }),
229
+ ..Default::default()
230
+ };
231
+ ```
232
+
233
+ ### Output formats
234
+
235
+ `ExtractionConfig::output_format` controls the `content` text format:
236
+
237
+ ```rust
238
+ pub enum OutputFormat { Plain, Markdown, Djot, Html, Json, DocTags, Custom(String) }
239
+ ```
240
+
241
+ `ExtractionConfig::result_format` controls the result structure:
242
+
243
+ ```rust
244
+ pub enum ResultFormat { Unified, ElementBased }
245
+ ```
246
+
247
+ ```rust
248
+ use xberg::{ExtractionConfig, OutputFormat};
249
+
250
+ let config = ExtractionConfig {
251
+ output_format: OutputFormat::Markdown,
252
+ ..Default::default()
253
+ };
254
+ ```
255
+
256
+ ---
257
+
258
+ ## ExtractionResult (envelope)
259
+
260
+ `extract` and `extract_batch` return this envelope. Per-document data lives in each `ExtractedDocument` in `results`.
261
+
262
+ ```rust
263
+ pub struct ExtractionResult {
264
+ pub results: Vec<ExtractedDocument>, // one per input, in order
265
+ pub errors: Vec<ExtractionErrorItem>, // non-fatal per-input errors
266
+ pub summary: ExtractionSummary, // aggregate counts
267
+ pub crawl_final_urls: Vec<String>,
268
+ pub crawl_redirect_count: usize,
269
+ pub crawl_unique_normalized_urls: Vec<String>,
270
+ }
271
+
272
+ pub struct ExtractionSummary {
273
+ pub inputs: usize,
274
+ pub results: usize,
275
+ pub errors: usize,
276
+ pub remote_urls: usize,
277
+ pub pages_crawled: usize,
278
+ pub documents_downloaded: usize,
279
+ }
280
+
281
+ pub struct ExtractionErrorItem {
282
+ pub index: usize,
283
+ pub code: u32,
284
+ pub error_type: String,
285
+ pub source: String,
286
+ pub message: String,
287
+ }
288
+ ```
289
+
290
+ ### `ExtractedDocument`
291
+
292
+ ```rust
293
+ pub struct ExtractedDocument {
294
+ pub content: String,
295
+ pub mime_type: Cow<'static, str>,
296
+ pub metadata: Metadata,
297
+ pub extraction_method: Option<ExtractionMethod>,
298
+ pub tables: Vec<Table>,
299
+ pub detected_languages: Option<Vec<String>>,
300
+ pub chunks: Option<Vec<Chunk>>,
301
+ pub images: Option<Vec<ExtractedImage>>,
302
+ pub pages: Option<Vec<PageContent>>,
303
+ pub elements: Option<Vec<Element>>,
304
+ pub extracted_keywords: Option<Vec<Keyword>>,
305
+ pub quality_score: Option<f64>,
306
+ pub processing_warnings: Vec<ProcessingWarning>,
307
+ // ... additional optional fields
308
+ }
309
+ ```
310
+
311
+ Note that `detected_languages`, `chunks`, `images`, `pages`, `elements`, and `extracted_keywords` are `Option<Vec<...>>` — match or `if let Some(...)` before iterating.
312
+
313
+ ```rust
314
+ use xberg::{extract, ChunkingConfig, ExtractInput, ExtractionConfig};
315
+
316
+ #[tokio::main]
317
+ async fn main() -> xberg::Result<()> {
318
+ let config = ExtractionConfig {
319
+ chunking: Some(ChunkingConfig { max_characters: 512, overlap: 50, ..Default::default() }),
320
+ ..Default::default()
321
+ };
322
+
323
+ let output = extract(ExtractInput::from_uri("document.pdf"), &config).await?;
324
+ let document = &output.results[0];
325
+
326
+ println!("Content: {}", document.content);
327
+ println!("MIME: {}", document.mime_type);
328
+
329
+ if let Some(langs) = &document.detected_languages {
330
+ println!("Languages: {langs:?}");
331
+ }
332
+ if let Some(chunks) = &document.chunks {
333
+ println!("Chunks: {}", chunks.len());
334
+ for chunk in chunks {
335
+ println!(" - {}", &chunk.content[..50.min(chunk.content.len())]);
336
+ }
337
+ }
338
+ Ok(())
339
+ }
340
+ ```
341
+
342
+ ### `Chunk`
343
+
344
+ ```rust
345
+ pub struct Chunk {
346
+ pub content: String,
347
+ pub chunk_type: ChunkType,
348
+ pub embedding: Option<Vec<f32>>,
349
+ pub metadata: ChunkMetadata,
350
+ }
351
+ ```
352
+
353
+ ---
354
+
355
+ ## Error Handling
356
+
357
+ ### `XbergError`
358
+
359
+ ```rust
360
+ pub enum XbergError {
361
+ Io(std::io::Error),
362
+ Parsing { message: String, source: Option<Box<dyn std::error::Error + Send + Sync>> },
363
+ Ocr { message: String, source: Option<Box<dyn std::error::Error + Send + Sync>> },
364
+ Validation { message: String, source: Option<Box<dyn std::error::Error + Send + Sync>> },
365
+ Cache { message: String, source: Option<Box<dyn std::error::Error + Send + Sync>> },
366
+ ImageProcessing { message: String, source: Option<Box<dyn std::error::Error + Send + Sync>> },
367
+ Serialization { message: String, source: Option<Box<dyn std::error::Error + Send + Sync>> },
368
+ MissingDependency(String),
369
+ Plugin { message: String, plugin_name: String },
370
+ LockPoisoned(String),
371
+ UnsupportedFormat(String),
372
+ Other(String),
373
+ }
374
+ ```
375
+
376
+ ```rust
377
+ use xberg::{extract, ExtractInput, ExtractionConfig, XbergError, Result};
378
+
379
+ async fn extract_text(bytes: &[u8], mime_type: &str) -> Result<String> {
380
+ let config = ExtractionConfig::default();
381
+ let output = extract(
382
+ ExtractInput::from_bytes(bytes.to_vec(), mime_type, Some("document.pdf".to_string())),
383
+ &config,
384
+ )
385
+ .await?;
386
+
387
+ Ok(output.results.first().map(|d| d.content.clone()).unwrap_or_default())
388
+ }
389
+
390
+ #[tokio::main]
391
+ async fn main() {
392
+ let bytes = std::fs::read("document.pdf").unwrap_or_default();
393
+ match extract_text(&bytes, "application/pdf").await {
394
+ Ok(text) => println!("Extracted {} chars", text.len()),
395
+ Err(XbergError::UnsupportedFormat(mime)) => eprintln!("Format not supported: {mime}"),
396
+ Err(XbergError::Ocr { message, .. }) => eprintln!("OCR failed: {message}"),
397
+ Err(e) => eprintln!("Error: {e}"),
398
+ }
399
+ }
400
+ ```
401
+
402
+ ### Result type alias
403
+
404
+ ```rust
405
+ pub type Result<T> = std::result::Result<T, XbergError>;
406
+ ```
407
+
408
+ ---
409
+
410
+ ## Version
411
+
412
+ This reference targets Xberg `1.1.0`.
@@ -0,0 +1,252 @@
1
+ <!--
2
+ AI-RULEZ :: GENERATED FILE — DO NOT EDIT
3
+ Content-Hash: blake3:e3c1dcb34a4784efc4f7fd868468061c3bd49d41e7e39792086633dcfe029d63
4
+ Source-Hash: blake3:3fca38eb564d0ed9c9194d070fd8dec96de727edc92e82954cb4b9af52cddbaf
5
+ Schema-Version: v1
6
+ -->
7
+
8
+ # Supported Formats Reference
9
+
10
+ Xberg supports 107 formats across 140 unique file extensions and accepts 53 compatibility MIME aliases. The tables below summarize the current extension families; `xberg formats` and the [generated format reference](https://docs.xberg.io/reference/formats/) are authoritative for individual MIME mappings and feature-gated availability.
11
+
12
+ ## Office Documents
13
+
14
+ ### Word Processing
15
+
16
+ | Format | Extensions | MIME Type | Capabilities |
17
+ | ------------------ | ------------------------ | ------------------------------------------------------------------------- | --------------------------------------------------------------- |
18
+ | Microsoft Word | `.docx`, `.doc` | OOXML and legacy Word MIME types | Full text extraction, tables, embedded images, metadata, styles |
19
+ | Word Macro-Enabled | `.docm` | `application/vnd.ms-word.document.macroEnabled.12` | Macro-enabled document extraction, metadata |
20
+ | Word Template | `.dotx`, `.dotm`, `.dot` | Various Word template MIME types | Template document extraction, metadata |
21
+ | OpenDocument Text | `.odt` | `application/vnd.oasis.opendocument.text` | Full text extraction, tables, embedded images, metadata, styles |
22
+ | Apple Pages | `.pages` | `application/x-iwork-pages-sffpages` | Text, tables, images, and metadata |
23
+ | WordPerfect | `.wpd`, `.wp`, `.wp5`, `.wp6` | `application/vnd.wordperfect` | WordPerfect 4.2 through X-series documents |
24
+
25
+ ### Spreadsheets
26
+
27
+ | Format | Extensions | MIME Type | Capabilities |
28
+ | ------------------------ | ---------- | ---------------------------------------------------------------------- | -------------------------------------------------------- |
29
+ | Excel Workbook | `.xlsx` | `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet` | Sheet data, cell values, formulas, cell metadata, charts |
30
+ | Excel Macro-Enabled | `.xlsm` | `application/vnd.ms-excel.sheet.macroEnabled.12` | Sheet data, formulas, macros (text only), metadata |
31
+ | Excel Binary | `.xlsb` | `application/vnd.ms-excel.sheet.binary.macroEnabled.12` | Binary sheet data extraction, metadata |
32
+ | Excel Legacy | `.xls` | `application/vnd.ms-excel` | Legacy sheet data extraction, metadata |
33
+ | Excel Add-in | `.xla` | `application/vnd.ms-excel.template.macroEnabled.12` | Add-in data extraction |
34
+ | Excel Macro Add-in | `.xlam` | `application/vnd.ms-excel.addin.macroEnabled.12` | Macro add-in metadata |
35
+ | Excel Template (XML) | `.xltx`, `.xltm` | OOXML spreadsheet template MIME types | XML template data and metadata |
36
+ | Excel Template (Legacy) | `.xlt` | `application/vnd.ms-excel` | Legacy template data extraction |
37
+ | OpenDocument Spreadsheet | `.ods` | `application/vnd.oasis.opendocument.spreadsheet` | Sheet data, cell values, formulas, metadata |
38
+ | Apple Numbers | `.numbers` | `application/x-iwork-numbers-sffnumbers` | Sheet data, formulas, and metadata |
39
+
40
+ ### Presentations
41
+
42
+ | Format | Extensions | MIME Type | Capabilities |
43
+ | ----------------------- | ------------------------ | --------------------------------------------------------------------------- | ---------------------------------------------------- |
44
+ | PowerPoint Presentation | `.pptx`, `.pptm` | OOXML presentation MIME types | Slide text, speaker notes, embedded images, metadata |
45
+ | PowerPoint Legacy | `.ppt`, `.pps` | `application/vnd.ms-powerpoint` | Legacy slide text extraction, metadata |
46
+ | PowerPoint Slideshow | `.ppsx` | `application/vnd.openxmlformats-officedocument.presentationml.slideshow` | Slideshow content, speaker notes, metadata |
47
+ | PowerPoint Template | `.potx`, `.potm`, `.pot` | Various PowerPoint template MIME types | Template slide extraction, metadata |
48
+ | OpenDocument Presentation | `.odp` | `application/vnd.oasis.opendocument.presentation` | Slides, notes, images, and metadata |
49
+ | Apple Keynote | `.key` | `application/x-iwork-keynote-sffkey` | Slides, notes, images, and metadata |
50
+
51
+ ### PDF
52
+
53
+ | Format | Extensions | MIME Type | Capabilities |
54
+ | ------------------------ | ---------- | ----------------- | -------------------------------------------------------------------------------------------------- |
55
+ | Portable Document Format | `.pdf` | `application/pdf` | Text extraction, tables, embedded images, metadata, OCR (when needed), password protection support |
56
+
57
+ ### eBooks
58
+
59
+ | Format | Extensions | MIME Type | Capabilities |
60
+ | ----------- | ---------- | ------------------------------- | ------------------------------------------------------ |
61
+ | EPUB | `.epub` | `application/epub+zip` | Chapter text, metadata, embedded resources, navigation |
62
+ | FictionBook | `.fb2` | `application/x-fictionbook+xml` | Book content, metadata, chapter structure |
63
+
64
+ ### Database
65
+
66
+ | Format | Extensions | MIME Type | Capabilities |
67
+ | ------ | ---------- | ------------------- | ----------------------------------------------------- |
68
+ | dBASE | `.dbf` | `application/vnd.dbf` | Table data extraction as markdown, field type support |
69
+ | SQLite | `.sqlite`, `.sqlite3`, `.db` | `application/vnd.sqlite3` | Bounded table extraction and schema metadata |
70
+ | GeoPackage | `.gpkg`, `.gpkx` | `application/geopackage+sqlite3` | SQLite table extraction with application-ID detection |
71
+
72
+ ### Hangul
73
+
74
+ | Format | Extensions | MIME Type | Capabilities |
75
+ | --------------------- | --------------- | ----------------------------------------------- | --------------------------------------- |
76
+ | Hangul Word Processor | `.hwp`, `.hwpx` | `application/x-hwp`, `application/haansofthwpx` | Korean document format, text extraction |
77
+
78
+ ## Images (OCR-Enabled)
79
+
80
+ ### Raster Images
81
+
82
+ | Format | Extensions | MIME Type | Capabilities |
83
+ | ------ | --------------- | ------------ | ---------------------------------------------------------------------------- |
84
+ | PNG | `.png` | `image/png` | OCR text extraction, table detection, EXIF metadata, dimensions, color space |
85
+ | JPEG | `.jpg`, `.jpeg` | `image/jpeg` | OCR text extraction, table detection, EXIF metadata, color profile |
86
+ | GIF | `.gif` | `image/gif` | OCR text extraction, animation metadata, dimensions |
87
+ | WebP | `.webp` | `image/webp` | OCR text extraction, metadata, lossy/lossless detection |
88
+ | Bitmap | `.bmp` | `image/bmp` | OCR text extraction, dimensions, color depth |
89
+ | TIFF | `.tiff`, `.tif` | `image/tiff` | OCR text extraction, multi-page support, EXIF metadata, compression info |
90
+ | HEIC family | `.heic`, `.heics`, `.heif`, `.heifs`, `.hif`, `.avif`, `.avcs` | HEIF/AVIF MIME types | Metadata extraction and optional pixel decoding |
91
+
92
+ ### Advanced Image Formats
93
+
94
+ | Format | Extensions | MIME Type | Capabilities |
95
+ | ------------------ | ------------------------------ | ------------------------- | -------------------------------------------------------------------------------- |
96
+ | JPEG 2000 container | `.jp2`, `.jpg2` | `image/jp2` | OCR via pure Rust decoder (hayro-jpeg2000), table detection, resolution metadata |
97
+ | JPEG 2000 codestream | `.j2c`, `.j2k`, `.jpc` | `image/j2c` | OCR for raw JPEG 2000 codestreams |
98
+ | JBIG2 | `.jbig2`, `.jb2` | `image/x-jbig2` | Bi-level image OCR, high compression, technical documents |
99
+ | Portable PixMap | `.pnm`, `.pbm`, `.pgm`, `.ppm` | `.pnm`=`image/x-portable-anymap`, `.pbm`=`image/x-portable-bitmap`, `.pgm`=`image/x-portable-graymap`, `.ppm`=`image/x-portable-pixmap` | OCR for plain image formats, raw pixel data |
100
+
101
+ ### Vector Graphics
102
+
103
+ | Format | Extensions | MIME Type | Capabilities |
104
+ | ------------------------ | ---------- | --------------- | ------------------------------------------------------------------------- |
105
+ | Scalable Vector Graphics | `.svg` | `image/svg+xml` | DOM parsing, embedded text extraction, graphics metadata, vector elements |
106
+
107
+ ## Web & Data
108
+
109
+ ### Markup & Structured Text
110
+
111
+ | Format | Extensions | MIME Type | Capabilities |
112
+ | ---------------- | --------------- | ----------------------- | ---------------------------------------------------------------------------------- |
113
+ | HyperText Markup | `.html`, `.htm` | `text/html` | DOM parsing, text extraction, metadata (Open Graph, Twitter Card), link extraction |
114
+ | XHTML | `.xhtml`, `.xht` | `application/xhtml+xml` | XML-serialized HTML extraction and metadata |
115
+ | XML | `.xml` | `application/xml` | DOM parsing, namespace handling, text extraction, structure analysis |
116
+ | KML | `.kml` | `application/vnd.google-earth.kml+xml` | Geographic features through structural XML extraction |
117
+
118
+ ### Structured Data Formats
119
+
120
+ | Format | Extensions | MIME Type | Capabilities |
121
+ | ------ | --------------- | --------------------------- | ---------------------------------------------------------- |
122
+ | JSON | `.json` | `application/json` | Schema detection, nested structure parsing, validation |
123
+ | GeoJSON | `.geojson` | `application/geo+json` | Geographic objects and coordinates through structured JSON extraction |
124
+ | JSON Lines | `.jsonl`, `.ndjson` | `application/x-ndjson` | Newline-delimited JSON record extraction |
125
+ | YAML | `.yaml`, `.yml` | `application/yaml` | Hierarchical data parsing, custom tags, nested structures |
126
+ | TOML | `.toml` | `application/toml` | Configuration parsing, table structures, type preservation |
127
+ | CSV | `.csv` | `text/csv` | Delimiter detection, header inference, type detection |
128
+ | TSV | `.tsv` | `text/tab-separated-values` | Tab-separated value parsing, header detection |
129
+
130
+ ### Text & Markup Languages
131
+
132
+ | Format | Extensions | MIME Type | Capabilities |
133
+ | ---------------- | ------------------ | ----------------- | ------------------------------------------------- |
134
+ | Plain Text | `.txt` | `text/plain` | Raw text extraction, encoding detection |
135
+ | AsciiDoc | `.adoc`, `.asciidoc` | `text/asciidoc` | AsciiDoc structure and text extraction |
136
+ | WebVTT | `.vtt` | `text/vtt` | Timed cue and transcript extraction |
137
+ | Markdown | `.md`, `.markdown` | `text/markdown` | CommonMark parsing, GFM extensions, front matter |
138
+ | CommonMark | `.commonmark` | `text/x-commonmark` | Standard CommonMark parsing |
139
+ | Quarto | `.qmd` | `text/x-quarto` | Quarto Markdown extraction |
140
+ | R Markdown | `.rmd` | `text/x-r-markdown` | R Markdown extraction |
141
+ | Djot | `.djot`, `.dj` | `text/x-djot` | Djot format parsing, semantic structure |
142
+ | Docling DocTags | `.doctags` | `text/vnd.docling.doctags` | DocTags representation extraction |
143
+ | reStructuredText | `.rst` | `text/prs.fallenstein.rst` | RST parsing, directive handling, role extraction |
144
+ | Org Mode | `.org` | `text/org` | Org mode structure, outline parsing, metadata |
145
+ | Rich Text Format | `.rtf` | `application/rtf` | Text with formatting extraction, font information |
146
+ | MDX | `.mdx` | `text/mdx` | Markdown and embedded JSX content |
147
+
148
+ ## Audio & Video
149
+
150
+ | Category | Extensions | Capabilities |
151
+ | -------- | ---------- | ------------ |
152
+ | Audio | `.mp3`, `.mpga`, `.m4a`, `.wav`, `.webm` | Whisper transcription |
153
+ | MP4 audio track | `.mp4`, `.mpg4`, `.mp4v`, `.m4v` | Audio-track transcription |
154
+ | MPEG audio track | `.mpeg`, `.mpg`, `.mpe`, `.m1v`, `.m2v` | Audio-track transcription |
155
+ | WebM audio track | `.webm` | Audio-track transcription |
156
+
157
+ ## Email & Archives
158
+
159
+ ### Email Formats
160
+
161
+ | Format | Extensions | MIME Type | Capabilities |
162
+ | ----------------- | ---------- | ---------------------------- | -------------------------------------------------------------------------------------- |
163
+ | Email Message | `.eml` | `message/rfc822` | Headers (from, to, subject, date), body (HTML/plain text), attachments, threading info |
164
+ | Microsoft Outlook | `.msg` | `application/vnd.ms-outlook` | Outlook headers, body content, attachments, recipient metadata |
165
+ | Outlook Data File | `.pst` | `application/vnd.ms-outlook-pst` | Folder hierarchy, messages, attachments, and metadata |
166
+
167
+ ### Archive Formats
168
+
169
+ | Format | Extensions | MIME Type | Capabilities |
170
+ | ----------- | ---------- | ----------------------------- | ---------------------------------------------------------- |
171
+ | ZIP Archive | `.zip` | `application/zip` | File listing, nested archive support, compression metadata |
172
+ | Tar Archive | `.tar` | `application/x-tar` | File listing, permission metadata, nested archives |
173
+ | Gzip Tar | `.tgz` | `application/gzip` | Compressed archive listing, metadata |
174
+ | Gzip | `.gz` | `application/gzip` | Compressed file metadata |
175
+ | 7-Zip | `.7z` | `application/x-7z-compressed` | File listing, compression info, nested archives |
176
+
177
+ ## Academic & Scientific
178
+
179
+ ### Citation Formats
180
+
181
+ | Format | Extensions | MIME Type | Capabilities |
182
+ | ----------------------- | ----------- | ---------------------------------------- | ------------------------------------------------- |
183
+ | BibTeX | `.bib` | `application/x-bibtex` | Structured parsing, entry types, field extraction |
184
+ | BibLaTeX | `.bib` | `application/x-biblatex` | Extended BibTeX format, advanced field support |
185
+ | RIS | `.ris` | `application/x-research-info-systems` | Structured RIS format parsing, type detection |
186
+ | NIH RIS | `.nbib` | `application/x-pubmed` | NIH/PubMed format, structured citation data |
187
+ | EndNote | `.enw` | `application/x-endnote+xml` | EndNote XML format, citation metadata |
188
+ | Citation Style Language | — | `application/csl+json` | CSL JSON parsing, style definitions |
189
+
190
+ ### Scientific & Technical Formats
191
+
192
+ | Format | Extensions | MIME Type | Capabilities |
193
+ | ---------------- | ---------------- | -------------------------- | ----------------------------------------------------------- |
194
+ | LaTeX | `.tex`, `.latex` | `application/x-latex` | LaTeX source parsing, commands, document structure |
195
+ | Typst | `.typ`, `.typst` | `text/vnd.typst` | Typst markup parsing, document structure |
196
+ | JATS XML | `.jats`, `.nxml` | `application/x-jats+xml` | PubMed JATS parsing, article structure, metadata |
197
+ | Jupyter Notebook | `.ipynb` | `application/x-ipynb+json` | Cell extraction (code + markdown), output parsing, metadata |
198
+ | DocBook | `.docbook`, `.dbk`, `.docbook4`, `.docbook5` | `application/docbook+xml` | DocBook XML parsing, semantic structure |
199
+
200
+ ### Documentation Formats
201
+
202
+ | Format | Extensions | MIME Type | Capabilities |
203
+ | ----------- | ---------- | ------------------------ | ----------------------------------------------- |
204
+ | OPML | `.opml` | `application/xml+opml` | Outline parsing, hierarchy extraction, metadata |
205
+
206
+ ## Format Capabilities Summary
207
+
208
+ ### Text Extraction
209
+
210
+ Supported formats expose text, metadata, or both according to the active feature set. OCR and transcription extend text extraction to images, scans, audio, and video.
211
+
212
+ ### Metadata Support
213
+
214
+ Comprehensive metadata extraction includes:
215
+
216
+ - Document properties (title, author, subject, creation date, modification date)
217
+ - Format-specific metadata (page count, dimensions, encoding, language)
218
+ - EXIF data (for images)
219
+ - Document statistics (word count, character count)
220
+
221
+ ### OCR (Optical Character Recognition)
222
+
223
+ OCR is available for image formats:
224
+
225
+ - **Raster Images**: PNG, JPEG, GIF, WebP, BMP, TIFF
226
+ - **Advanced Formats**: JPEG 2000, JBIG2, PNM/PBM/PGM/PPM
227
+ - **Configurable Backends**: Tesseract (default), PaddleOCR (`paddleocr`/`paddle-ocr`), VLM (Candle-based: TrOCR, PaddleOCR-VL, GLM-OCR, DeepSeek-OCR)
228
+
229
+ ### Table Detection
230
+
231
+ Smart table detection and reconstruction available for:
232
+
233
+ - PDF documents (native tables and scanned content with OCR)
234
+ - Office documents (Excel, Word)
235
+ - Images (via OCR backends)
236
+ - HTML/XML (from markup structure)
237
+
238
+ ### Archive & Nested Document Support
239
+
240
+ Archives and nested formats support file listing and sequential extraction:
241
+
242
+ - ZIP, TAR, TGZ, 7Z archives
243
+ - Email attachments
244
+ - Nested archives within archives
245
+
246
+ ## Getting Started
247
+
248
+ For language-specific examples and detailed API documentation, see the [API Reference](https://docs.xberg.io/reference/api-python/).
249
+
250
+ For OCR configuration and backend selection, see the [OCR Backends Guide](https://docs.xberg.io/guides/ocr/).
251
+
252
+ For comprehensive format details and format detection, see the [Complete Format Reference](https://docs.xberg.io/reference/formats/).
@@ -0,0 +1,14 @@
1
+ ---
2
+ description: Extract a document locally with Xberg
3
+ ---
4
+
5
+ <!--
6
+ AI-RULEZ :: GENERATED FILE — DO NOT EDIT
7
+ Content-Hash: blake3:3d695d0525269a1935328e6568418a562cac9ba7a64c6e8121d5136dc93b36e3
8
+ Source-Hash: blake3:3fca38eb564d0ed9c9194d070fd8dec96de727edc92e82954cb4b9af52cddbaf
9
+ Schema-Version: v1
10
+ -->
11
+
12
+ Extract this document: $ARGUMENTS
13
+
14
+ Read the xberg and picking-a-format skills. Use `xberg extract <file> --format json` and choose --content-format for the consumer. Preserve input paths as separate arguments. Report extraction errors and content omissions.