all2md.options.base
Base classes for parser and renderer options.
This module defines the foundation classes for all format-specific options used throughout the all2md conversion pipeline.
- class all2md.options.base.CloneFrozenMixin
Bases:
objectMixin providing frozen dataclass cloning capabilities.
This mixin adds the ability to create modified copies of frozen dataclass instances, which is useful for immutable configuration objects.
- create_updated(**kwargs: Any) Self
Create a new instance with updated field values.
- Parameters:
**kwargs (Any) – Field names and their new values
- Returns:
New instance with specified fields updated
- Return type:
Self
- __init__() None
- class all2md.options.base.BaseRendererOptions
Bases:
CloneFrozenMixinBase class for all renderer options.
This class serves as the foundation for format-specific renderer options. Renderers convert AST documents into various output formats (Markdown, DOCX, PDF, etc.).
- Parameters:
fail_on_resource_errors (bool, default=False) – Whether to raise RenderingError when resource loading fails (e.g., images). If False (default), warnings are logged but rendering continues. If True, rendering stops immediately on resource errors.
max_asset_size_bytes (int) – Maximum allowed size in bytes for any single asset (images, downloads, etc.)
Notes
Subclasses should define format-specific rendering options as frozen dataclass fields.
- fail_on_resource_errors: bool = False
- max_asset_size_bytes: int = 52428800
- metadata_policy: MetadataRenderPolicy
- creator: str | None = 'all2md'
- __init__(fail_on_resource_errors: bool = False, max_asset_size_bytes: int = 52428800, metadata_policy: MetadataRenderPolicy = <factory>, creator: str | None = 'all2md') None
- class all2md.options.base.BaseParserOptions
Bases:
CloneFrozenMixinBase class for all parser options.
This class serves as the foundation for format-specific parser options. Parsers convert source documents into AST representation.
For parsers that handle attachments (images, downloads, etc.), also inherit from AttachmentOptionsMixin to get attachment-related configuration fields.
- Parameters:
extract_metadata (bool) – Whether to extract document metadata
Notes
Subclasses should define format-specific parsing options as frozen dataclass fields.
For parsers handling binary assets (PDF, DOCX, HTML, etc.), also inherit from AttachmentOptionsMixin:
@dataclass(frozen=True) class PdfOptions(BaseParserOptions, AttachmentOptionsMixin): pass
- extract_metadata: bool = False
- __init__(extract_metadata: bool = False) None