Skip to main content
MarkItDown provides extensive configuration options to customize behavior, integrate with LLM services, and control converter registration.

Basic Configuration

Create a MarkItDown instance with optional configuration:

Constructor Parameters

The MarkItDown class (_markitdown.py:93) accepts the following parameters:

Core Parameters

bool
default:"True"
Enable built-in converters for PDF, DOCX, XLSX, HTML, and other formats. Set to False to disable all built-ins.
bool
default:"False"
Enable third-party plugin converters. Plugins must be installed and will be discovered via entry points.
requests.Session
default:"None"
Custom requests.Session for HTTP operations. If not provided, MarkItDown creates a session with markdown preference headers.

LLM Integration

Configure LLM services for enhanced conversion (e.g., image captioning):
Any
default:"None"
LLM client instance for generating descriptions. Compatible with OpenAI client or similar interfaces.
str
default:"None"
Model name/identifier to use with the LLM client (e.g., "gpt-4-vision-preview").
str
default:"None"
Custom prompt template for LLM requests. Used by converters that support LLM-based processing.

Converter Options

str
default:"None"
Path to the exiftool binary for extracting image metadata. If not specified, MarkItDown searches common system paths and the EXIFTOOL_PATH environment variable.
str
default:"None"
Custom style map for DOCX conversion. Defines how Word styles map to Markdown formatting.

Document Intelligence

Configure Azure Document Intelligence for advanced document processing:
str
default:"None"
Azure Document Intelligence endpoint URL. When provided, enables the Document Intelligence converter.
Any
default:"None"
Azure credential for Document Intelligence authentication.
list
default:"None"
List of file types to process with Document Intelligence.
str
default:"None"
API version for Document Intelligence service.

Configuration Examples

Basic Usage with Defaults

With LLM Integration

Enable AI-powered image captioning:

With Custom Requests Session

Use a custom session for proxy, authentication, or custom headers:

With Plugins Enabled

Custom Converters Only

Disable built-ins and register only your custom converters:

With Azure Document Intelligence

With Custom DOCX Styling

Control how Word styles map to Markdown:

With Custom ExifTool Path

Dynamic Configuration

Enabling Built-ins After Creation

If you initially disable built-ins, you can enable them later:

Enabling Plugins After Creation

Both enable_builtins() and enable_plugins() can only be called once. Calling them again will raise a warning.

Per-Conversion Options

You can pass additional options to specific conversions:

Environment Variables

MarkItDown checks the following environment variables:

EXIFTOOL_PATH

Specify the path to the exiftool binary:
Searched paths (in order):
  1. exiftool_path constructor parameter
  2. EXIFTOOL_PATH environment variable
  3. Common system paths:
    • /usr/bin
    • /usr/local/bin
    • /opt/bin
    • /opt/local/bin
    • /opt/homebrew/bin
    • C:\Windows\System32
    • C:\Program Files
    • C:\Program Files (x86)

Converter Registration

Manually register converters with custom priority:

Default Requests Session

If no requests_session is provided, MarkItDown creates one with these headers (_markitdown.py:110):
This signals servers that markdown is preferred over other formats.

Configuration Object Pattern

For complex setups, use a configuration object:

Best Practices

Reuse Instances: Create one MarkItDown instance and reuse it for multiple conversions. Configuration overhead is minimal after initialization.
Environment-Based Config: Use environment variables for sensitive data like API keys and service endpoints.
Plugin Security: Only enable plugins from trusted sources. Plugins execute arbitrary code during conversion.
LLM Rate Limits: When using LLM integration, be mindful of API rate limits and costs, especially for batch processing.

Next Steps

Custom Converters

Create your own document converters

Plugin Development

Build and distribute MarkItDown plugins