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
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
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
impl InputFormat
Sourcepub fn from_id(id: &str) -> Option<Self>
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.
Sourcepub fn from_mime(mime: &str) -> Option<Self>
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.
Sourcepub fn from_extension(ext: &str) -> Option<Self>
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).
Sourcepub fn extensions(self) -> impl Iterator<Item = &'static str>
pub fn extensions(self) -> impl Iterator<Item = &'static str>
The file extensions that route to this format (lowercase, no dot), in
[EXTENSIONS] order.
Sourcepub fn is_compiled_in(self) -> bool
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.
Sourcepub fn detect(bytes: &[u8]) -> Option<InputFormat>
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.
pub fn supported_extensions() -> Vec<&'static str>
Trait Implementations§
Source§impl Clone for InputFormat
impl Clone for InputFormat
impl Copy for InputFormat
Source§impl Debug for InputFormat
impl Debug for InputFormat
impl Eq for InputFormat
Source§impl Hash for InputFormat
impl Hash for InputFormat
Source§impl PartialEq for InputFormat
impl PartialEq for InputFormat
impl StructuralPartialEq for InputFormat
Auto Trait Implementations§
impl Freeze for InputFormat
impl RefUnwindSafe for InputFormat
impl Send for InputFormat
impl Sync for InputFormat
impl Unpin for InputFormat
impl UnsafeUnpin for InputFormat
impl UnwindSafe for InputFormat
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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