all2md.options.webarchive
Configuration options for Safari WebArchive parsing.
This module defines options for parsing Safari WebArchive (.webarchive) files.
- class all2md.options.webarchive.WebArchiveOptions
Bases:
HtmlOptionsConfiguration options for WebArchive-to-Markdown conversion.
This dataclass contains settings specific to Safari WebArchive file processing, including options for handling embedded resources and nested frames.
- Parameters:
extract_subresources (bool, default False) – Whether to extract embedded resources (images, CSS, JS) from WebSubresources. When True, resources are saved to attachment_output_dir if configured.
handle_subframes (bool, default True) – Whether to process nested iframe content from WebSubframeArchives. When True, content from nested frames is included in the output.
Examples
- Basic conversion:
>>> options = WebArchiveOptions()
- Extract all embedded resources:
>>> options = WebArchiveOptions( ... extract_subresources=True, ... attachment_output_dir="./extracted" ... )
- Ignore nested frames:
>>> options = WebArchiveOptions(handle_subframes=False)
Notes
Inherits all options from HtmlOptions, including: - extract_title - strip_dangerous_elements - attachment_mode - network security settings - local file access settings
- extract_subresources: bool = False
- handle_subframes: bool = True
- __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, extract_title: bool = False, convert_nbsp: bool = False, strip_dangerous_elements: bool = False, strip_framework_attributes: bool = False, detect_table_alignment: bool = True, network: NetworkFetchOptions = <factory>, local_files: LocalFileAccessOptions = <factory>, strip_comments: bool = True, collapse_whitespace: bool = True, extract_readable: bool = False, br_handling: BrHandling = 'newline', allowed_elements: tuple[str, ...] | None=None, allowed_attributes: tuple[str, ...] | dict[str, tuple[str, ...]] | None=None, figures_parsing: FiguresParsing = 'blockquote', details_parsing: DetailsParsing = 'blockquote', extract_microdata: bool = True, base_url: str | None = None, html_parser: HtmlParser = 'html.parser', extract_subresources: bool = False, handle_subframes: bool = True) None