all2md.options.pptx
PPTX parser and renderer options.
- class all2md.options.pptx.PptxRendererOptions
Bases:
BaseRendererOptionsConfiguration options for rendering AST to PPTX format.
This dataclass contains settings specific to PowerPoint presentation generation from AST, including slide splitting strategies and layout.
- Parameters:
slide_split_mode ({"separator", "heading", "auto"}, default "auto") – How to split the AST into slides: - “separator”: Split on ThematicBreak nodes (mirrors parser behavior) - “heading”: Split on specific heading level - “auto”: Try separator first, fallback to heading-based splitting
slide_split_heading_level (int, default 2) – Heading level to use for slide splits when using heading mode. Level 2 (H2) is typical (H1 might be document title).
default_layout (str, default "Title and Content") – Default slide layout name from template.
title_slide_layout (str, default "Title Slide") – Layout name for the first slide.
use_heading_as_slide_title (bool, default True) – Use first heading in slide content as slide title.
template_path (str or None, default None) – Path to .pptx template file. If None, uses default blank template.
default_font (str, default "Calibri") – Default font for slide content.
default_font_size (int, default 18) – Default font size in points for body text.
title_font_size (int, default 44) – Font size for slide titles.
list_number_spacing (int, default 1) – Number of spaces after the number prefix in ordered lists (e.g., “1. “ has 1 space). Affects visual consistency of manually numbered lists.
list_indent_per_level (float, default 0.5) – Indentation per nesting level for lists, in inches. Controls horizontal spacing for nested lists. Note that actual indentation behavior may vary across PowerPoint templates.
table_left (float, default 0.5) – Left position for tables in inches.
table_top (float, default 2.0) – Top position for tables in inches.
table_width (float, default 9.0) – Width for tables in inches.
table_height_per_row (float, default 0.5) – Height per row for tables in inches.
image_left (float, default 1.0) – Left position for images in inches.
image_top (float, default 2.5) – Top position for images in inches.
image_width (float, default 4.0) – Width for images in inches (aspect ratio maintained).
network (NetworkFetchOptions, default NetworkFetchOptions()) – Network security options for fetching remote images in slides.
include_notes (bool, default True) – Whether to detect and render speaker notes from “Speaker Notes” sections. When True, H3 headings with “Speaker Notes” text are detected, and content after them is rendered to slide speaker notes. When False, speaker notes sections are ignored and rendered as regular slide content.
comment_mode ({"speaker_notes", "visible", "ignore"}, default "speaker_notes") – How to render Comment and CommentInline AST nodes: - “speaker_notes”: Render in slide speaker notes (default) - “visible”: Render as visible italic text in slide content - “ignore”: Skip comments entirely
force_textbox_bullets (bool, default True) – Enable bullets via OOXML manipulation for unordered lists in text boxes. When True (default), bullets are explicitly enabled via OOXML for all text boxes. When False, bullets are only applied to content placeholders (native PowerPoint behavior). Set to False if using strict templates that conflict with OOXML manipulation.
slide_width (float, default 13.333) – Slide width in inches. Default is widescreen 16:9 (13.333”).
slide_height (float, default 7.5) – Slide height in inches. Default is 7.5” (standard for both 4:3 and 16:9).
content_margin_left (float, default 0.5) – Left margin for content area in inches.
content_margin_right (float, default 0.5) – Right margin for content area in inches.
content_margin_top (float, default 1.5) – Top margin for content area in inches (below title area).
content_margin_bottom (float, default 0.5) – Bottom margin for content area in inches.
element_gap (float, default 0.2) – Vertical gap between content blocks in inches.
use_flow_layout (bool, default True) – Enable the flow layout engine that positions text, tables, and images sequentially to avoid overlap. When False, uses the legacy fixed-position behavior where all text shares one frame and tables/images use fixed positions.
Notes
List Rendering Limitations:
python-pptx has limited support for automatic list numbering. This renderer uses manual numbering for ordered lists by adding number prefixes (e.g., “1. “) as text runs. The following options provide some control over list formatting:
list_number_spacing: Controls spacing after numberslist_indent_per_level: Controls nesting indentation
However, deeper nesting and exact spacing behavior can be inconsistent across different PowerPoint templates. These limitations are inherent to python-pptx’s API and the complexity of PowerPoint’s list formatting system.
Unordered Lists in Text Boxes:
For unordered lists, bullets are explicitly enabled via OOXML manipulation to ensure they appear in both text boxes and content placeholders. Text boxes do not enable bullets by default, unlike content placeholders.
- slide_split_mode: Literal['separator', 'heading', 'auto'] = 'auto'
- slide_split_heading_level: int = 2
- default_layout: str = 'Title and Content'
- title_slide_layout: str = 'Title Slide'
- use_heading_as_slide_title: bool = True
- template_path: str | None = None
- default_font: str = 'Calibri'
- default_font_size: int = 24
- title_font_size: int = 44
- list_number_spacing: int = 1
- list_indent_per_level: float = 0.5
- table_left: float = 0.5
- table_top: float = 2.0
- table_width: float = 12.333
- table_height_per_row: float = 0.5
- image_left: float = 1.0
- image_top: float = 2.5
- image_width: float = 5.0
- network: NetworkFetchOptions
- include_notes: bool = True
- comment_mode: Literal['speaker_notes', 'visible', 'ignore'] = 'speaker_notes'
- force_textbox_bullets: bool = True
- slide_width: float = 13.333
- slide_height: float = 7.5
- content_margin_left: float = 0.5
- content_margin_right: float = 0.5
- content_margin_top: float = 1.5
- content_margin_bottom: float = 0.5
- element_gap: float = 0.2
- use_flow_layout: bool = True
- __init__(fail_on_resource_errors: bool = False, max_asset_size_bytes: int = 52428800, metadata_policy: MetadataRenderPolicy = <factory>, creator: str | None = 'all2md', slide_split_mode: SlideSplitMode = 'auto', slide_split_heading_level: int = 2, default_layout: str = 'Title and Content', title_slide_layout: str = 'Title Slide', use_heading_as_slide_title: bool = True, template_path: str | None = None, default_font: str = 'Calibri', default_font_size: int = 24, title_font_size: int = 44, list_number_spacing: int = 1, list_indent_per_level: float = 0.5, table_left: float = 0.5, table_top: float = 2.0, table_width: float = 12.333, table_height_per_row: float = 0.5, image_left: float = 1.0, image_top: float = 2.5, image_width: float = 5.0, network: NetworkFetchOptions = <factory>, include_notes: bool = True, comment_mode: PptxCommentMode = 'speaker_notes', force_textbox_bullets: bool = True, slide_width: float = 13.333, slide_height: float = 7.5, content_margin_left: float = 0.5, content_margin_right: float = 0.5, content_margin_top: float = 1.5, content_margin_bottom: float = 0.5, element_gap: float = 0.2, use_flow_layout: bool = True) None
- class all2md.options.pptx.PptxOptions
Bases:
PaginatedParserOptionsConfiguration options for PPTX-to-Markdown conversion.
This dataclass contains settings specific to PowerPoint presentation processing, including slide numbering and image handling.
- Parameters:
include_slide_numbers (bool, default False) – Whether to include slide numbers in the output.
include_notes (bool, default True) – Whether to include speaker notes in the conversion.
comment_mode ({"content", "comment", "ignore"}, default "content") – How to parse speaker notes in the AST: - “content”: Parse as regular content nodes with H3 heading (default, current behavior) - “comment”: Parse as Comment AST nodes with metadata - “ignore”: Skip speaker notes entirely Note: This controls parsing of speaker notes. For rendering, see PptxRendererOptions.comment_mode.
Examples
- Convert with slide numbers and base64 images:
>>> options = PptxOptions(include_slide_numbers=True, attachment_mode="base64")
- Convert slides only (no notes):
>>> options = PptxOptions(include_notes=False)
- Parse speaker notes as Comment nodes:
>>> options = PptxOptions(comment_mode="comment")
- include_slide_numbers: bool = False
- include_notes: bool = True
- comment_mode: Literal['content', 'comment', 'ignore'] = 'content'
- slides: str | None = None
- charts_mode: Literal['data', 'mermaid', 'both'] = 'data'
- include_titles_as_h2: bool = True
- strict_list_detection: bool = False
- __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, page_separator_template: str = '-----', include_slide_numbers: bool = False, include_notes: bool = True, comment_mode: PptxParserCommentMode = 'content', slides: str | None = None, charts_mode: ChartsMode = 'data', include_titles_as_h2: bool = True, strict_list_detection: bool = False) None