# eluc1a/marker architecture

> Architecture diagram of the GitHub repository eluc1a/marker, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/eluc1a/marker
- Repository: https://github.com/eluc1a/marker

## Overview

Marker converts document files through format-specific providers into a structured page/block model, then applies layout, OCR, table, and cleanup processing before rendering markdown, JSON, HTML, or chunks. Optional LLM processors improve or correct extracted content through configured model services. The README also documents structured extraction and a table-only converter. The sampled excerpts show selected processor and renderer behavior; links for unsampled subsystem wiring are limited to documented capabilities and clear module responsibilities.

Main entry points: [`marker/converters/pdf.py`](https://github.com/eluc1a/marker/blob/master/marker/converters/pdf.py) (PDF converter), [`marker/schema/document.py`](https://github.com/eluc1a/marker/blob/master/marker/schema/document.py) (Document model), [`marker/processors`](https://github.com/eluc1a/marker/tree/master/marker/processors) (Document processors), [`marker/scripts/convert_single.py`](https://github.com/eluc1a/marker/blob/master/marker/scripts/convert_single.py) (Conversion CLI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User interfaces"]
  node_cli["Conversion CLI<br/>[convert_single.py]"]
  node_interactive["Interactive app<br/>[streamlit_app.py]"]
  node_server["HTTP server<br/>[server.py]"]
end

subgraph group_ingest["Document ingestion"]
  node_providers["Format providers"]
  node_pdfprovider["PDF provider<br/>[pdf.py]"]
end

subgraph group_understand["Extraction and processing"]
  node_document["Document model<br/>[document.py]"]
  node_builders["Page builders"]
  node_layout["Layout builder<br/>[layout.py]"]
  node_ocr["OCR builder<br/>[ocr.py]"]
  node_processor["Document processors"]
  node_tables["Table recognition<br/>[table.py]"]
  node_llmprocessors["LLM corrections"]
  node_schema["Block schema"]
end

subgraph group_results["Output and integrations"]
  node_pdfconverter["PDF converter<br/>[pdf.py]"]
  node_tableconverter["Table converter<br/>[table.py]"]
  node_extraction["Schema extraction<br/>[extraction.py]"]
  node_renderers["Format renderers"]
  node_markdown["Markdown renderer<br/>[markdown.py]"]
  node_services["LLM services"]
end

node_user(("Document user"))
node_files["Converted files"]
node_llm(("LLM provider"))

node_user -->|"submits file"| node_cli
node_user -->|"uploads file"| node_interactive
node_user -->|"sends request"| node_server
node_cli -->|"invokes conversion"| node_pdfconverter
node_interactive -->|"invokes conversion"| node_pdfconverter
node_server -->|"invokes conversion"| node_pdfconverter
node_pdfconverter -->|"selects format"| node_providers
node_providers -->|"provides page content"| node_document
node_pdfprovider -->|"provides text and refs"| node_document
node_pdfconverter -->|"builds pages"| node_builders
node_builders -->|"creates layout"| node_layout
node_builders -->|"recognizes text"| node_ocr
node_layout -->|"adds page structure"| node_document
node_ocr -->|"updates text blocks"| node_document
node_pdfconverter -->|"runs processors"| node_processor
node_processor -->|"recognizes tables"| node_tables
node_processor -.->|"runs optional corrections"| node_llmprocessors
node_tables -->|"adds table cells"| node_document
node_processor -->|"updates blocks"| node_schema
node_pdfconverter -->|"renders document"| node_renderers
node_renderers -->|"formats markdown"| node_markdown
node_pdfconverter -.->|"alternative converter"| node_tableconverter
node_pdfconverter -.->|"alternative extraction"| node_extraction
node_llmprocessors -.->|"requests corrections"| node_services
node_services -.->|"calls model"| node_llm
node_renderers -->|"produces output"| node_files
node_cli -->|"saves results"| node_files

click node_cli "https://github.com/eluc1a/marker/blob/master/marker/scripts/convert_single.py"
click node_interactive "https://github.com/eluc1a/marker/blob/master/marker/scripts/streamlit_app.py"
click node_server "https://github.com/eluc1a/marker/blob/master/marker/scripts/server.py"
click node_providers "https://github.com/eluc1a/marker/tree/master/marker/providers"
click node_pdfprovider "https://github.com/eluc1a/marker/blob/master/marker/providers/pdf.py"
click node_document "https://github.com/eluc1a/marker/blob/master/marker/schema/document.py"
click node_builders "https://github.com/eluc1a/marker/tree/master/marker/builders"
click node_layout "https://github.com/eluc1a/marker/blob/master/marker/builders/layout.py"
click node_ocr "https://github.com/eluc1a/marker/blob/master/marker/builders/ocr.py"
click node_processor "https://github.com/eluc1a/marker/tree/master/marker/processors"
click node_tables "https://github.com/eluc1a/marker/blob/master/marker/processors/table.py"
click node_llmprocessors "https://github.com/eluc1a/marker/tree/master/marker/processors/llm"
click node_schema "https://github.com/eluc1a/marker/tree/master/marker/schema/blocks"
click node_pdfconverter "https://github.com/eluc1a/marker/blob/master/marker/converters/pdf.py"
click node_tableconverter "https://github.com/eluc1a/marker/blob/master/marker/converters/table.py"
click node_extraction "https://github.com/eluc1a/marker/blob/master/marker/converters/extraction.py"
click node_renderers "https://github.com/eluc1a/marker/tree/master/marker/renderers"
click node_markdown "https://github.com/eluc1a/marker/blob/master/marker/renderers/markdown.py"
click node_services "https://github.com/eluc1a/marker/tree/master/marker/services"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_interactive,node_server,node_user toneBlue
class node_providers,node_pdfprovider toneAmber
class node_document,node_builders,node_layout,node_ocr,node_processor,node_tables,node_llmprocessors,node_schema toneMint
class node_pdfconverter,node_tableconverter,node_extraction,node_renderers,node_markdown,node_services toneRose
class node_files,node_llm toneIndigo
```

## Components

### User interfaces

- [Conversion CLI](https://github.com/eluc1a/marker/blob/master/marker/scripts/convert_single.py): `marker/scripts/convert_single.py`
- [Interactive app](https://github.com/eluc1a/marker/blob/master/marker/scripts/streamlit_app.py): `marker/scripts/streamlit_app.py`
- [HTTP server](https://github.com/eluc1a/marker/blob/master/marker/scripts/server.py): `marker/scripts/server.py`

### Document ingestion

- [Format providers](https://github.com/eluc1a/marker/tree/master/marker/providers): `marker/providers`
- [PDF provider](https://github.com/eluc1a/marker/blob/master/marker/providers/pdf.py): `marker/providers/pdf.py`

### Extraction and processing

- [Document model](https://github.com/eluc1a/marker/blob/master/marker/schema/document.py): `marker/schema/document.py`
- [Page builders](https://github.com/eluc1a/marker/tree/master/marker/builders): `marker/builders`
- [Layout builder](https://github.com/eluc1a/marker/blob/master/marker/builders/layout.py): `marker/builders/layout.py`
- [OCR builder](https://github.com/eluc1a/marker/blob/master/marker/builders/ocr.py): `marker/builders/ocr.py`
- [Document processors](https://github.com/eluc1a/marker/tree/master/marker/processors): `marker/processors`
- [Table recognition](https://github.com/eluc1a/marker/blob/master/marker/processors/table.py): `marker/processors/table.py`
- [LLM corrections](https://github.com/eluc1a/marker/tree/master/marker/processors/llm): `marker/processors/llm`
- [Block schema](https://github.com/eluc1a/marker/tree/master/marker/schema/blocks): `marker/schema/blocks`

### Output and integrations

- [PDF converter](https://github.com/eluc1a/marker/blob/master/marker/converters/pdf.py): `marker/converters/pdf.py`
- [Table converter](https://github.com/eluc1a/marker/blob/master/marker/converters/table.py): `marker/converters/table.py`
- [Schema extraction](https://github.com/eluc1a/marker/blob/master/marker/converters/extraction.py): `marker/converters/extraction.py`
- [Format renderers](https://github.com/eluc1a/marker/tree/master/marker/renderers): `marker/renderers`
- [Markdown renderer](https://github.com/eluc1a/marker/blob/master/marker/renderers/markdown.py): `marker/renderers/markdown.py`
- [LLM services](https://github.com/eluc1a/marker/tree/master/marker/services): `marker/services`

### Other components

- **Document user**
- **Converted files**
- **LLM provider**

## Connections

- Document user → Conversion CLI: submits file
- Document user → Interactive app: uploads file
- Document user → HTTP server: sends request
- Conversion CLI → PDF converter: invokes conversion
- Interactive app → PDF converter: invokes conversion
- HTTP server → PDF converter: invokes conversion
- PDF converter → Format providers: selects format
- Format providers → Document model: provides page content
- PDF provider → Document model: provides text and refs
- PDF converter → Page builders: builds pages
- Page builders → Layout builder: creates layout
- Page builders → OCR builder: recognizes text
- Layout builder → Document model: adds page structure
- OCR builder → Document model: updates text blocks
- PDF converter → Document processors: runs processors
- Document processors → Table recognition: recognizes tables
- Document processors → LLM corrections: runs optional corrections
- Table recognition → Document model: adds table cells
- Document processors → Block schema: updates blocks
- PDF converter → Format renderers: renders document
- Format renderers → Markdown renderer: formats markdown
- PDF converter → Table converter: alternative converter
- PDF converter → Schema extraction: alternative extraction
- LLM corrections → LLM services: requests corrections
- LLM services → LLM provider: calls model
- Format renderers → Converted files: produces output
- Conversion CLI → Converted files: saves results
