PPTX writer: support notes field in metadata for title slide (#11396)

This adds support for a `notes` field in the YAML metadata block
that will be used as speaker notes for the title slide in PowerPoint
output.

Previously, there was no way to add speaker notes to the title slide
since it is generated from metadata rather than from content blocks.
The `::: notes` syntax only works for content slides.

Example usage:

    ---
    title: My Presentation
    notes: |
      Welcome everyone to this presentation.
      Remember to introduce yourself.
    ---

Closes #5844 (for PPTX output).

Co-authored-by: Chris Callison-Burch <ccb+github@upenn.edu>
This commit is contained in:
Chris Callison-Burch
2026-01-14 05:14:30 -05:00
committed by GitHub
parent ca0f375498
commit d14dee0dc2
6 changed files with 31 additions and 1 deletions
+17
View File
@@ -6938,6 +6938,23 @@ in handouts and presenter view.
Notes are not yet supported for other slide formats, but the notes
will not appear on the slides themselves.
### Speaker notes on the title slide (PowerPoint)
For PowerPoint output, the title slide is generated from the document's
YAML metadata block. To add speaker notes to this slide, use a `notes`
field in the metadata:
---
title: My Presentation
author: Jane Doe
notes: |
Welcome everyone to this presentation.
Remember to introduce yourself and mention the key topics.
---
The `notes` field can contain multiple paragraphs and Markdown formatting.
## Columns
To put material in side by side columns, you can use a native
@@ -887,6 +887,12 @@ getMetaSlide = do
subtitle <- inlinesToParElems $ lookupMetaInlines "subtitle" meta
authors <- mapM inlinesToParElems $ docAuthors meta
date <- inlinesToParElems $ docDate meta
-- Get speaker notes from metadata "notes" field
let notesBlocks = lookupMetaBlocks "notes" meta
speakerNotes <- if null notesBlocks
then return mempty
else local (\env -> env{envInSpeakerNotes=True}) $
SpeakerNotes . mconcat <$> mapM blockToParagraphs notesBlocks
if null title && null subtitle && null authors && null date
then return Nothing
else return $
@@ -894,7 +900,7 @@ getMetaSlide = do
Slide
metadataSlideId
(MetadataSlide title subtitle authors date)
mempty
speakerNotes
Nothing
addSpeakerNotesToMetaSlide :: Slide -> [Block] -> Pres (Slide, [Block])
+4
View File
@@ -126,6 +126,10 @@ tests = let
def
"pptx/speaker-notes-after-metadata/input.native"
"pptx/speaker-notes-after-metadata/output.pptx"
, pptxTests "speaker notes from metadata field"
def
"pptx/metadata-speaker-notes/input.native"
"pptx/metadata-speaker-notes/output.pptx"
, pptxTests "remove empty slides"
def
"pptx/remove-empty-slides/input.native"
@@ -0,0 +1,3 @@
Pandoc (Meta {unMeta = fromList [("author",MetaInlines [Str "Jesse",Space,Str "Rosenthal"]),("notes",MetaBlocks [Para [Str "These",Space,Str "are",Space,Str "speaker",Space,Str "notes",Space,Str "from",Space,Str "metadata."]]),("title",MetaInlines [Str "Testing"])]})
[Header 1 ("a-header",[],[]) [Str "A",Space,Str "header"]
,Para [Str "And",Space,Str "a",Space,Str "new",Space,Str "slide."]]
Binary file not shown.
Binary file not shown.