all2md.options.zip

Configuration options for ZIP archive parsing.

This module defines options for parsing ZIP files with resource extraction.

class all2md.options.zip.ZipOptions

Bases: BaseParserOptions, AttachmentOptionsMixin

Configuration options for ZIP archive to Markdown conversion.

This dataclass contains settings specific to ZIP/archive processing, including file filtering, directory structure handling, and attachment extraction. Inherits attachment handling from AttachmentOptionsMixin for extracting embedded resources.

Parameters:
  • include_patterns (list[str] or None, default None) – Glob patterns for files to include (e.g., ['*.pdf', '*.docx']). If None, all parseable files are included.

  • exclude_patterns (list[str] or None, default None) – Glob patterns for files to exclude (e.g., ['__MACOSX/*', '.DS_Store']).

  • max_depth (int or None, default None) – Maximum directory depth to traverse. None means unlimited.

  • create_section_headings (bool, default True) – Whether to create section headings for each extracted file.

  • preserve_directory_structure (bool, default True) – Whether to include directory path in section headings.

  • flatten_structure (bool, default False) – Whether to flatten directory structure (ignore paths in output).

  • extract_resource_files (bool, default True) – Whether to extract non-parseable files (images, CSS, etc.) to attachment directory.

  • resource_file_extensions (list[str] or None, default None) – List of file extensions to treat as resources (e.g., ['.png', '.css', '.js']). If None, uses default list from RESOURCE_FILE_EXTENSIONS in constants. If empty list [], no files are treated as resources (all are parsed). Extensions should include the leading dot and are case-insensitive.

  • skip_empty_files (bool, default True) – Whether to skip files with no content or that fail to parse.

  • include_resource_manifest (bool, default True) – Whether to include a manifest table of extracted resources at the end of the document.

  • enable_parallel_processing (bool, default False) – Whether to enable parallel processing for large archives (opt-in). When enabled and file count exceeds parallel_threshold, files are processed in parallel using a process pool for improved performance.

  • max_workers (int or None, default None) – Maximum number of worker processes for parallel processing. If None, defaults to the number of CPU cores available.

  • parallel_threshold (int, default 10) – Minimum number of files required to enable parallel processing. Archives with fewer files are always processed sequentially.

include_patterns: list[str] | None = None
exclude_patterns: list[str] | None = None
max_depth: int | None = None
create_section_headings: bool = True
preserve_directory_structure: bool = True
extract_resource_files: bool = True
resource_file_extensions: list[str] | None = None
skip_empty_files: bool = True
include_resource_manifest: bool = True
enable_parallel_processing: bool = False
max_workers: int | None = None
parallel_threshold: int = 10
__init__(attachment_mode: AttachmentMode = 'alt_text', alt_text_mode: AltTextMode = 'default', attachment_output_dir: str | None = None, attachment_base_url: str | None = None, max_asset_size_bytes: int = 52428800, attachment_filename_template: str = '{stem}_{type}{seq}.{ext}', attachment_overwrite: AttachmentOverwriteMode = 'unique', attachment_deduplicate_by_hash: bool = False, attachments_footnotes_section: str | None = 'Attachments', extract_metadata: bool = False, include_patterns: list[str] | None = None, exclude_patterns: list[str] | None = None, max_depth: int | None = None, create_section_headings: bool = True, preserve_directory_structure: bool = True, extract_resource_files: bool = True, resource_file_extensions: list[str] | None = None, skip_empty_files: bool = True, include_resource_manifest: bool = True, enable_parallel_processing: bool = False, max_workers: int | None = None, parallel_threshold: int = 10) None