all2md.parsers.pptx
PPTX to AST converter.
This module provides conversion from Microsoft PowerPoint presentations to AST representation. It replaces direct markdown string generation with structured AST building, enabling multiple rendering strategies and improved testability.
- class all2md.parsers.pptx.PptxToAstConverter
Bases:
BaseParserConvert PPTX to AST representation.
This converter parses PowerPoint presentations using python-pptx and builds an AST that can be rendered to various markdown flavors.
- Parameters:
options (PptxOptions or None, default = None) – Conversion options
Initialize the PPTX parser with options and progress callback.
- __init__(options: PptxOptions | None = None, progress_callback: Callable[[ProgressEvent], None] | None = None)
Initialize the PPTX parser with options and progress callback.
- parse(input_data: str | Path | IO[bytes] | bytes) Document
Parse PPTX input into an AST Document.
- Parameters:
input_data (str, Path, IO[bytes], or bytes) – The PPTX document to parse. Can be: - File path (str or Path) - File-like object in binary mode - Raw PPTX bytes
- Returns:
AST Document node representing the parsed PPTX structure
- Return type:
- Raises:
ParsingError – If parsing fails due to invalid format or corruption
DependencyError – If python-pptx is not installed
- convert_to_ast(prs: Presentation) Document
Convert PPTX presentation to AST Document.
- Parameters:
prs (Presentation) – PPTX presentation to convert
- Returns:
AST document node
- Return type:
- extract_metadata(document: Any) DocumentMetadata
Extract metadata from PPTX presentation.
- Parameters:
document (Presentation) – python-pptx Presentation object
- Returns:
Extracted metadata
- Return type: