Skip to main content

InputFormat

Enum InputFormat 

Source
pub enum InputFormat {
Show 53 variants Docx, Pptx, Html, Image, Pdf, Asciidoc, Md, Csv, Xlsx, Doc, Xls, Ppt, Odt, Ods, Odp, XmlUspto, XmlJats, XmlXbrl, XmlDoclang, DocTags, Dclx, MetsGbs, JsonDocling, Audio, Video, Vtt, Ebcdic, Latex, Email, Epub, Mhtml, Rtf, Visio, Svg, Pages, Numbers, Keynote, Abiword, WordPerfect, Works, Dbf, Dif, Sylk, QuattroPro, Lotus, StarOffice5, Djvu, Text, Jsonl, Xml, Ipynb, Feed, Plugin,
}
Expand description

A document format supported by docling.rs backends.

Variants§

§

Docx

§

Pptx

§

Html

§

Image

§

Pdf

§

Asciidoc

§

Md

§

Csv

§

Xlsx

§

Doc

Word 97–2004 binary (.doc) — parsed natively (CFB + MS-DOC), no external converter (docling shells out to LibreOffice for these).

§

Xls

Excel 97–2004 binary (.xls, BIFF8) — parsed natively via calamine.

§

Ppt

PowerPoint 97–2003 binary (.ppt) — parsed natively (CFB + MS-PPT).

§

Odt

§

Ods

§

Odp

§

XmlUspto

§

XmlJats

§

XmlXbrl

§

XmlDoclang

§

DocTags

Raw DocTags markup (.doctags/.dt) — the token stream docling’s VLMs emit, parsed by docling_core::doctags (#152).

§

Dclx

A DocLang OPC archive (.dclx, the format --to dclx writes).

§

MetsGbs

§

JsonDocling

§

Audio

§

Video

Video containers (.mp4/.avi/.mov/.mkv/.webm) — Phase 1 of issue #138 transcribes the audio track through the ASR pipeline (mirrors docling’s InputFormat.VIDEO, v2.114).

§

Vtt

§

Ebcdic

EBCDIC mainframe data + JSON copybook layout (#252, docling 2.118).

§

Latex

§

Email

§

Epub

§

Mhtml

MIME HTML archive (.mhtml/.mht) — docling’s InputFormat.MHTML (docling#4184), unwrapped and converted as HTML.

§

Rtf

Rich Text Format (.rtf) — a docling.rs extension (#209); docling converts RTF only by shelling out to LibreOffice.

§

Visio

Microsoft Visio (.vsdx, .vsdm) — a docling.rs extension (#214); docling has no Visio reader. Pages become sections, shape text flows in reading order, connectors become a relations table.

§

Svg

SVG (.svg) — a docling.rs extension (#212); docling does not accept SVG input. Mirrors the pdf / pdf-text split: the ML build rasterizes (resvg) and rides the image pipeline; without ML — or under --no-ocr / --text-layer-only — <text> elements are extracted directly into flat paragraphs.

§

Pages

Apple Pages (.pages) — a conformance format (#318, #383): mirrors docling’s IWorkPagesDocumentBackend for both the 2013+ IWA package and the iWork ’09 index.xml generation.

§

Numbers

Apple Numbers (.numbers), same IWA machinery as Self::Pages.

§

Keynote

Apple Keynote (.key), same IWA machinery as Self::Pages.

§

Abiword

AbiWord (.abw/.zabw/.awt) — a docling.rs extension (#216); AWML XML (gzip-wrapped for .zabw), parsed natively.

§

WordPerfect

WordPerfect 5.x / 6.x+ documents (.wpd, .wp, .wp5, .wp6, .wpt) — a docling.rs extension (#216); the ÿWPC byte stream is parsed natively (docling reaches WordPerfect only via LibreOffice’s libwpd), text-level with bold/italic/underline runs.

§

Works

Microsoft Works word-processor documents (.wps) — a docling.rs extension (#216); Works 2.x DOS / 3 / 4 (WPS4) and Works 2000 / 6–9 (WPS8, OLE CONTENTS) parsed natively after libwps’ readers.

§

Dbf

dBase table (.dbf) — a docling.rs extension (#216); the field descriptors become the header row, records the data rows.

§

Dif

Data Interchange Format (.dif) — a docling.rs extension (#216); sheet snapshot, split into data regions like an ODS sheet.

§

Sylk

SYLK (.slk/.sylk) — a docling.rs extension (#216); same sheet-region conversion as DIF.

§

QuattroPro

Quattro Pro spreadsheets (.wq1/.wq2 DOS, .wb1–.wb3 Windows, .qpw 9–X9) — a docling.rs extension (#216) parsed natively after libwps’ readers.

§

Lotus

Lotus 1-2-3 / Symphony / MS Works spreadsheets (.wk1–.wk4, .wks, .wrk, .123) — a docling.rs extension (#216); the DOS-era record streams, content-sniffed on the BOF record and split into data regions like an ODS sheet.

§

StarOffice5

StarOffice 5 binaries (.sdw/.sda/.sdd/.vor) — a docling.rs extension (#215); CFB containers parsed natively (text-level extraction). The document kind comes from the stream inside, so a .vor template of any application dispatches by content. StarCalc (.sdc) is a follow-up.

§

Djvu

DjVu scanned documents (.djvu/.djv) — a docling.rs extension (#434); docling has no DjVu reader. Decoded in pure Rust (djvu-rs): the hidden per-page text layer by default, rasterize + OCR for scan-only pages when the ML pipeline is built.

§

Text

Plain text and source code (#671) — MarkItDown’s plain-text converter: a code extension (.py, .rs, .yaml, .sh, …) becomes one code block in that language, anything else paragraphs; also the fallback for an unknown or missing extension whose bytes are text. Markdown-like text (.txt, .md) stays Md, as docling reads it.

§

Jsonl

JSON Lines (.jsonl/.ndjson, #671): kept verbatim as one json code block. A .json is JsonDocling, which renders any other JSON the same way.

§

Xml

A bare .xml (#671): sniffed into the dialects docling reads — JATS, USPTO, XBRL, DocLang — or a feed (Feed, #678), and, matching none, kept as one xml code block with a warning. .nxml is XmlJats outright.

§

Ipynb

Jupyter notebook (.ipynb, #673): markdown cells as Markdown, code cells as code items in the kernel’s language, raw cells as code blocks; outputs under ipynb_outputs. A .json holding a notebook ("nbformat" + "cells") takes the same route.

§

Feed

An RSS 2.0, Atom or RSS 1.0 (RDF) feed (.rss, .atom, .rdf, application/rss+xml, application/atom+xml, or a bare .xml whose root says so; #678): the feed’s title, its description or subtitle, then per item a level-2 heading, its date and its body read through the HTML backend — MarkItDown’s _rss_converter shape. A docling.rs extension: docling has no feed backend.

§

Plugin

A format only a backend registered on the converter reads (#680, DocumentConverter::register_backend): what DocumentConverter::load_file and load_named_bytes resolve a source to when a registered backend claims it and the built-in tables do not know its extension or media type. Never the answer of an extension, media type or content check of their own; a converter without a backend that claims the source rejects it.

Implementations§

Source§

impl InputFormat

Source

pub fn as_str(self) -> &'static str

Stable string identifier, matching the Python enum values.

Source

pub fn from_id(id: &str) -> Option<Self>

The inverse of as_str: the format for one of its stable identifiers ("pdf", "xml_jats", …; case-insensitive), as the bindings receive it. None for anything else.

Source

pub fn from_mime(mime: &str) -> Option<Self>

Best-effort format detection from a media type (type/subtype, parameters and case ignored) — what an email attachment or an HTTP response declares when its name has no usable extension (#561). The generic application/octet-stream is None: it says nothing.

Source

pub fn from_extension(ext: &str) -> Option<Self>

Best-effort format detection from a file extension (case-insensitive).

Ambiguous extensions (notably bare xml) resolve to a single default here; the converter’s content sniffing does the real disambiguation. The mapping is the [EXTENSIONS] table — the one list supported_extensions prints too (#603).

Source

pub fn extensions(self) -> impl Iterator<Item = &'static str>

The file extensions that route to this format (lowercase, no dot), in [EXTENSIONS] order.

Source

pub fn is_compiled_in(self) -> bool

Whether this build converts the format. Every format stays detectable in every build, but a few need a cargo feature to convert: PDF the pdf ML pipeline or the pdf-text text-layer path, images and METS/GBS scan packages the pdf pipeline, audio and video the asr pipeline — without it the converter answers “not compiled in”. Missing runtime assets (models, ffmpeg) are not a build property and do not count here: those formats degrade or fail at conversion time with a message that names what to fetch.

Source

pub fn detect(bytes: &[u8]) -> Option<InputFormat>

Every input file extension this build converts — sorted, unique, lowercase, no dot: what docling-rs --list-input-formats prints (#603, Pandoc’s --list-input-formats), so a wrapper can ask the binary instead of hard-coding a list that drifts from it. Formats the build lacks (is_compiled_in) are left out, and so are two extensions that only route: .heic/.heif without the heif feature (libheif — the image pipeline cannot decode them) and StarCalc’s .sdc, which reaches the StarOffice backend for its targeted “save as .ods” error, never a document. The format bytes evidently are, from their content alone (#672) — what decides for an input with no usable name: stdin, an upload, a data: URL, an email attachment, a file with no or an unknown extension (SourceDocument::from_file and from_named_bytes call it after the extension and the media type). Signatures only, no classifier: PDF, RTF, the ZIP packages (OOXML, ODF, EPUB, Visio, Apple iWork), the OLE files (Word, Excel, PowerPoint, Outlook), flat Word 2.0, HTML, the raster images, DjVu, the audio and video containers, WordPerfect, WebVTT, DocTags, SVG, AbiWord, XML (the xml route then reads the dialect), JSON (a Jupyter notebook, else the docling-JSON route), MIME messages (MHTML by multipart/related, else email) and LaTeX. Prose, Markdown, CSV and AsciiDoc have no signature and come back None — the converter reads such input as plain text (#671) when the extension says nothing either.

A correctly named file never pays for this: the extension decides first. The Python docling_rs.detect_format and the Node detectFormat are this function.

Source

pub fn supported_extensions() -> Vec<&'static str>

Trait Implementations§

Source§

impl Clone for InputFormat

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for InputFormat

Source§

impl Debug for InputFormat

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for InputFormat

Source§

impl Hash for InputFormat

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for InputFormat

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for InputFormat

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(_simd: S, value: T) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V