Core API

The core API provides the main entry points for document conversion. These functions handle format detection, parsing, transformation, and rendering in a unified interface.

Main Functions

The primary functions for document conversion:

all2md.to_markdown

Convert document to Markdown format with enhanced format detection.

all2md.to_ast

Convert document to AST (Abstract Syntax Tree) format.

all2md.from_ast

Render AST document to a target format.

all2md.from_markdown

Convert Markdown content to another format.

all2md.convert

Convert between document formats.

Quality scoring, for deciding how much to trust a conversion:

all2md.confidence_report

Convert a document and return its conversion confidence report ("quality card").

all2md.roundtrip_report

Round-trip a document through via and score what survived.

all2md.roundtrippable_formats

Return the formats that can be both rendered to and parsed back from.

all2md.optimize_options

Search converter options for the settings that convert source best.

all2md.optimizable_formats

Return the formats optimize_options() knows how to tune.

For full function signatures and detailed documentation, see all2md.api.

Base Classes

Parser and renderer base classes define the interface that all format handlers implement:

all2md.options.base.BaseParserOptions

Base class for all parser options.

all2md.options.base.BaseRendererOptions

Base class for all renderer options.

all2md.parsers.base.BaseParser

Abstract base class for all document parsers.

all2md.renderers.base.BaseRenderer

Abstract base class for all AST renderers.

Common Options

Shared option classes used across multiple formats for network and file access:

all2md.options.common.NetworkFetchOptions

Network security options for remote resource fetching.

all2md.options.common.LocalFileAccessOptions

Local file access security options.

Exceptions

The exception hierarchy for handling conversion errors:

all2md.exceptions.All2MdError

Base exception class for all all2md-specific errors.

all2md.exceptions.ValidationError

Exception raised for invalid input parameters or options.

all2md.exceptions.FileError

Base exception for file access and I/O errors.

all2md.exceptions.FormatError

Exception raised when attempting to process an unsupported file format.

all2md.exceptions.ParsingError

Exception raised when document parsing fails.

all2md.exceptions.RenderingError

Exception raised when output rendering fails.

all2md.exceptions.TransformError

Exception raised when AST transformation fails.

all2md.exceptions.SecurityError

Base exception for security violations.

all2md.exceptions.DependencyError

Exception raised when required dependencies are not available.

Progress Reporting

Classes for tracking conversion progress:

all2md.progress.ProgressEvent

Progress event for document conversion operations.

all2md.progress.ProgressCallback

Type alias for progress callback functions.

Converter Registry

The registry system for format detection and converter lookup:

all2md.converter_registry.ConverterRegistry

Registry for managing document parsers and renderers.

all2md.converter_metadata.ConverterMetadata

Metadata describing a converter's capabilities and requirements.

Detailed Module Reference