API reference

Parsing

Markdown parser using markdown-it-py with plugin extensions.

AST node types for decktile.

class decktile.parser.ast.Arrow(content: str = '')[source]

Bases: Node

Connector between two cards (arrow icon, label, etc.).

class decktile.parser.ast.AttrNode(type: 'str' = '', value: 'str' = '', attrs: 'dict[str, str]'=<factory>)[source]

Bases: Node

class decktile.parser.ast.Card(header: 'str' = '', body: 'list[str]' = <factory>, children: 'list[Node]' = <factory>, tag: 'Optional[str]' = None, class_: 'str' = '', label: 'str' = '')[source]

Bases: Node

class decktile.parser.ast.CodeBlock(content: 'str' = '', language: 'str' = '')[source]

Bases: Node

class decktile.parser.ast.CodeSpan(content: 'str' = '')[source]

Bases: Inline

class decktile.parser.ast.Document(meta: 'Meta', slides: "list['Slide']")[source]

Bases: object

class decktile.parser.ast.Emphasis(children: 'list[Inline]' = <factory>)[source]

Bases: Inline

class decktile.parser.ast.Grid(cols: 'int' = 2, class_: 'str' = '', children: 'list[Node]' = <factory>)[source]

Bases: Node

class decktile.parser.ast.Heading(level: 'int' = 1, content: "list['Inline']" = <factory>)[source]

Bases: Node

class decktile.parser.ast.Image(src: 'str' = '', alt: 'str' = '', title: 'str' = '')[source]

Bases: Inline

class decktile.parser.ast.Inline[source]

Bases: object

class decktile.parser.ast.LayoutType(*values)[source]

Bases: Enum

Bases: Inline

class decktile.parser.ast.ListNode(items: 'list[list[Inline]]' = <factory>)[source]

Bases: Node

class decktile.parser.ast.LucideIcon(name: 'str' = '', attrs: 'dict[str, str]'=<factory>)[source]

Bases: Inline

class decktile.parser.ast.Meta(theme: 'str' = '', title: 'str' = '', footer: 'str' = '', paginate: 'bool' = False, size: 'str' = '16:9', style: 'str' = '', logo: 'str' = '', logo_dark: 'str' = '', watermark: 'str' = '', background: 'str' = '', pygments_style: 'str' = 'default', seaborn_theme: 'str' = '', theme_variant: 'str' = 'light', transition: 'str' = '', autoplay: 'int' = 7)[source]

Bases: object

physical_dims() → tuple[float, float][source]

Slide dimensions in mm for ODP/print.

class decktile.parser.ast.Notes(content: str = '', tag: str | None = None)[source]

Bases: Node

Full-width conclusion card below a comparison layout.

class decktile.parser.ast.Paragraph(content: "list['Inline']" = <factory>)[source]

Bases: Node

class decktile.parser.ast.Quote(content: "list['Inline']" = <factory>)[source]

Bases: Node

class decktile.parser.ast.Row(children: list[Node] = <factory>)[source]

Bases: Node

Horizontal row of elements placed side by side.

class decktile.parser.ast.Slide(layout: 'str' = 'content', children: "list['Node']" = <factory>, notes: 'str' = '', variant: 'str' = '', transition: 'str' = '')[source]

Bases: object

class decktile.parser.ast.SoftBreak[source]

Bases: Inline

class decktile.parser.ast.Strikethrough(children: 'list[Inline]' = <factory>)[source]

Bases: Inline

class decktile.parser.ast.Strong(children: 'list[Inline]' = <factory>)[source]

Bases: Inline

class decktile.parser.ast.Table(headers: 'list[str]' = <factory>, rows: 'list[list[str]]' = <factory>)[source]

Bases: Node

class decktile.parser.ast.Text(content: 'str' = '')[source]

Bases: Inline

Rendering

Slide intermediate representation.

Parses a Document AST into resolved, style-annotated slide structures that both HTML and PPTX renderers consume. Eliminates duplicate node-walking logic between renderers.

class decktile.render.ir.BoxGeometry(x: float = 0.0, y: float = 0.0, w: float = 0.0, h: float = 0.0, style: ResolvedStyle = <factory>, logo: BoxGeometry | None = None, watermark: BoxGeometry | None = None, footer: BoxGeometry | None = None, slide_num: BoxGeometry | None = None, text: str = '', substyles: dict[str, ~decktile.render.ir.ResolvedStyle]=<factory>, decorations: list[BoxGeometry] = <factory>)[source]

Border-box rect (cm, section-relative) plus resolved style for one Elem.

class decktile.render.ir.Elem(kind: str, content: str | list[Any] = '', text: str = '', font_size: int = 18, font_weight: str = 'normal', color: str = '', bg: str = '', accent: str = '', muted: str = '', level: int = 0, language: str = '', src: str = '', alt: str = '', header: str = '', body: list[str] = <factory>, headers: list[str] = <factory>, rows: list[list[str]] = <factory>, items: list[str] = <factory>, tag: str = '', class_: str = '', cols: int = 0, children: list[Elem] = <factory>, attrs: dict[str, str]=<factory>, layout: str = '', inlines: list[Any] = <factory>, item_inlines: list[list] = <factory>, svg: str = '', svg_live: str = '', pdf: bytes = b'', id: str = '', box: BoxGeometry | None = None)[source]

A single styled element on a slide.

class decktile.render.ir.ResolvedStyle(bg: str = '', bg_alpha: float = 1.0, fg: str = '#333333', border_color: str = '', border_width: float = 0.0, border_radius: float = 0.0, font_family: str = '', font_size_px: float = 18.0, font_weight: str = 'normal', font_italic: bool = False, text_align: str = 'left', bg_gradient: list[tuple[float, str, float]] | None = None, bg_angle_deg: float = 180.0, bg_image_url: str = '', bg_rgb01: tuple[float, float, float] = (1.0, 1.0, 1.0), padding_top: float = 0.0, padding_right: float = 0.0, padding_bottom: float = 0.0, padding_left: float = 0.0)[source]

Style resolved from a weasyprint box’s computed CSS, in CSS px / hex.

class decktile.render.ir.SlideIR(id: str = '', layout: str = 'content', elements: list[Elem] = <factory>, notes: str = '', variant: str = '', transition: str = '')[source]

A fully resolved slide ready for rendering.

decktile.render.ir.assemble_css(base_css: str, theme_css: str, dims: tuple[int, int], logo: str = '', watermark: str = '', pygments_style: str = 'default', logo_dark: str = '', background: str = '') → str[source]

Assemble the final CSS for HTML output: base + theme + logo + pygments.

decktile.render.ir.build_ir(doc: Document, base_css: str = '', theme_css: str = '') → list[SlideIR][source]

Convert a Document AST into a list of SlideIR objects.

decktile.render.ir.resolve_styles(base_css: str, theme_css: str) → dict[source]

Parse CSS into resolved style properties for IR elements.

HTML renderer for decktile.

decktile.render.html.load_theme(name: str) → str[source]

Load a named theme CSS file. Falls back to default if not found.

decktile.render.html.render_from_ir(ir_slides: list[SlideIR], doc: Document, assembled_css: str, dims: tuple[int, int]) → str[source]

Render already-built IR slides to the full HTML page.

Split out from render() so the ODP geometry pass can render the exact same IR (same data-decktile-id values) it will later annotate.

PDF renderer using weasyprint.

ODP renderer: thin orchestrator over geometry + styles + shapes.

build_ir -> annotate_geometry -> one DrawPage per slide, with its background built from that slide’s own resolved section style (gradient/ solid/bitmap-plus-overlay) – no separate dark-mode code path, the resolved style already reflects whatever data-theme the section had.

decktile.render.odp.render(doc: Document, output_path: Path, base_css: str = '', theme_css: str = '', source_dir: Path | None = None) → None[source]

Render Document AST to an ODP file.

Page size is always derived from the deck’s own px dimensions (doc.meta.dimensions()) via PX_TO_CM – the same ratio geometry.py positions every frame with. A fixed/independent page size (the old default 28x15.75cm) would clip content: the geometry pass lays out frames assuming the page equals the content’s real size.

predictygraph renderer for decktile pdg fenced blocks.

The slide theme’s body font and tag colours are passed to predictygraph as a stylesheet layered under the diagram’s own css, so node.green, node.cyan, node.yellow and node.red match decktile cards and anything in the block wins.

decktile.render.pdg.render_pdg_svg(content: str, font_family: str = '', font_size: int = 0, tag_colors: dict[str, tuple[str, str]] | None = None, blueprint: bool = False, animated: bool = False) → str | None[source]

Render a predictygraph diagram to SVG, or None if it fails to parse.

blueprint uses the palette for ::: card {blueprint} (light lines, translucent fills). animated keeps predictygraph’s SMIL animation (flow=, border=) for HTML; the default is a still frame, which PDF and ODP need.

decktile.render.pdg.theme_css(font_family: str = '', font_size: int = 0, tag_colors: dict[str, tuple[str, str]] | None = None) → str[source]

Slide theme as a predictygraph stylesheet.

Command line

decktile CLI entry point.