Code blocks
Place syntax-highlighted, animated code reveals into your slides. Syntax highlighting uses Pygments; animation uses PowerPoint Morph or native click builds.
Two animation engines
| Engine | How it works | Slides produced |
|---|---|---|
morph (default) | One slide per reveal step; identical code box, only highlight colours change; Morph cross-fades them | One per step |
native | One slide; each step’s code box is revealed on click via a <p:timing> tree | One |
Choose morph for smooth animated transitions between steps. Choose native for
an in-slide, click-to-reveal build that keeps everything on one slide.
Steps and focus
A code block is authored as source code plus a steps directive. Each step declares:
show— the cumulative line ranges visible at this step.focus— lines at full brightness; all other visible lines are dimmed.note— an optional speaker note for this step.
Steps can be authored three ways:
- Inline markers —
# >>> stepand# >>> focuscomment lines inside the code; the parser strips them and derives step boundaries from surrounding line positions. This form survives edits without re-pinning line numbers. - Markdown + JSON comment — a fenced code block followed by
<!-- slidura {"engine":"morph","steps":[…]} -->. - IR JSON directly — the full
CodeAnimobject; the preferred form for agents.
A shell helper is also available: lines starting with $ are treated as
commands and their following output as results, producing one step per command
with the command focused and its output dimmed.
Syntax highlighting
Pygments handles highlighting for all supported languages. The Pygments style is
set per block (default monokai). The engine draws a self-contained panel — a
rounded rectangle in the style’s background colour — inside the template’s
placeholder frame, so the code region reads legibly on any template background
without snapping to the template theme.
Placing a code block in a fill
Set the value of an image or content field to the sentinel for a stored code block:
{ "code_placeholder_1": "@code:<id>" }Agents can also supply the IR inline for a lighter-weight path:
{ "code_placeholder_1": { "$code": { "lang": "python", "code": "…", "steps": [] } } }API and MCP
| Surface | Details |
|---|---|
| REST | POST /api/v1/code-blocks, GET /api/v1/code-blocks/{id}, PUT /api/v1/code-blocks/{id}, DELETE /api/v1/code-blocks/{id} |
| MCP tools | create_code_block, list_code_blocks, get_code_block |
create_code_block accepts the CodeAnim IR directly — the agent emits the full
structured object rather than parsing syntax. The response includes the build_ref
field with the @code:<id> sentinel.
Caveats
Morph and click animations require PowerPoint 2016 or later to play correctly. LibreOffice and Quick Look will render the slides but will not animate them. The build validates that the OOXML structure is well-formed, but animated playback can only be verified by opening the deck in PowerPoint.
Auto-fit (shrinking text to fit a smaller placeholder) and template-theme colour snapping are not supported in v1. Font size is fixed at build time.