> ## Documentation Index
> Fetch the complete documentation index at: https://docs.abbyy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# DocLang

DocLang is an open document format designed for AI systems rather than for people or printers. It is the output format we recommend for FineParser.

## What DocLang is

Most document formats were designed for rendering. PDF describes where to draw pixels and HTML tells a browser how to lay out a page, but neither tells a language model what a document contains. Parsers that convert them for AI use end up guessing at reading order, flattening tables into strings, and dropping figures and metadata.

DocLang is a constrained XML format built for LLM tokenizers, so each element maps to a single model token. Every element carries a semantic role, bounding box coordinates, and a position in the reading order, and tables keep their full grid structure. It is a specification rather than a product, so any parser can produce it and any tool can consume it. The working group was founded by IBM, NVIDIA, Red Hat, ABBYY, HumanSignal, and Forgis, and the specification is developed under Joint Development Foundation Projects as an LF AI & Data project.

## Why FineParser outputs it

Plain text is cheap to feed to a model because it throws structure away, while HTML and Markdown keep the structure but spend many tokens describing it. DocLang keeps the structure at a fraction of the cost. A table encoded with DocLang's OTSL scheme needs five structural tokens where the equivalent HTML needs twenty-eight.

DocLang also defines one canonical representation for each kind of content, so every tool that supports it produces the same output for the same document. Code written against FineParser's output will work with any other DocLang producer, and your documents stay portable if you change parsers later.

## Example

The following DocLang fragment describes a heading and a small table, each with its bounding box on the page.

```xml theme={null}
<doclang>
  <heading level="1">
    <location value="48"/><location value="40"/>
    <location value="420"/><location value="72"/>
    Q3 Financial Summary
  </heading>
  <table>
    <location value="48"/><location value="88"/>
    <location value="420"/><location value="168"/>
    <ched/>Quarter<ched/>Revenue<ched/>YoY<nl/>
    <fcel/>Q3 2024<fcel/>$42M<fcel/>+18%<nl/>
  </table>
</doclang>
```

The four `<location>` elements give the corners of the bounding box. Inside the table, `<ched/>` introduces a column header cell, `<fcel/>` introduces a data cell, and `<nl/>` ends the row.

## Files

FineParser writes DocLang as a single `.doclang` file containing the markup. The DocLang specification also defines a `.dclx` archive, a ZIP package that bundles the markup with extracted images and other assets, but FineParser does not produce that form.

## Learn more

The [doclang.ai](https://doclang.ai/) site has a project overview and an interactive viewer. The full specification and the reference toolkit live in the [doclang-project repository](https://github.com/doclang-project/doclang) on GitHub, which also provides the `doclang` Python package for validating and packaging DocLang files.
