diff options
| author | Chris Callison-Burch <[email protected]> | 2026-01-14 05:14:30 -0500 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-01-14 11:14:30 +0100 |
| commit | d14dee0dc2dd8d0d929d695feee18588aa4707a9 (patch) | |
| tree | b11138b80fd2b84a4091062e516d58e8ddbedcde | |
| parent | ca0f375498be7de671a32ad3a0590780d8490e0c (diff) | |
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 <[email protected]>
| -rw-r--r-- | MANUAL.txt | 17 | ||||
| -rw-r--r-- | src/Text/Pandoc/Writers/Powerpoint/Presentation.hs | 8 | ||||
| -rw-r--r-- | test/Tests/Writers/Powerpoint.hs | 4 | ||||
| -rw-r--r-- | test/pptx/metadata-speaker-notes/input.native | 3 | ||||
| -rw-r--r-- | test/pptx/metadata-speaker-notes/output.pptx | bin | 0 -> 31689 bytes | |||
| -rw-r--r-- | test/pptx/metadata-speaker-notes/templated.pptx | bin | 0 -> 44773 bytes |
6 files changed, 31 insertions, 1 deletions
diff --git a/MANUAL.txt b/MANUAL.txt index 28c6341d0..28d4aa160 100644 --- a/MANUAL.txt +++ b/MANUAL.txt @@ -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 diff --git a/src/Text/Pandoc/Writers/Powerpoint/Presentation.hs b/src/Text/Pandoc/Writers/Powerpoint/Presentation.hs index 9e7bcb04f..b969c645b 100644 --- a/src/Text/Pandoc/Writers/Powerpoint/Presentation.hs +++ b/src/Text/Pandoc/Writers/Powerpoint/Presentation.hs @@ -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]) diff --git a/test/Tests/Writers/Powerpoint.hs b/test/Tests/Writers/Powerpoint.hs index 35269205b..c8dc00e6e 100644 --- a/test/Tests/Writers/Powerpoint.hs +++ b/test/Tests/Writers/Powerpoint.hs @@ -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" diff --git a/test/pptx/metadata-speaker-notes/input.native b/test/pptx/metadata-speaker-notes/input.native new file mode 100644 index 000000000..1b34755e0 --- /dev/null +++ b/test/pptx/metadata-speaker-notes/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."]] diff --git a/test/pptx/metadata-speaker-notes/output.pptx b/test/pptx/metadata-speaker-notes/output.pptx Binary files differnew file mode 100644 index 000000000..8f46a780c --- /dev/null +++ b/test/pptx/metadata-speaker-notes/output.pptx diff --git a/test/pptx/metadata-speaker-notes/templated.pptx b/test/pptx/metadata-speaker-notes/templated.pptx Binary files differnew file mode 100644 index 000000000..3f78d6401 --- /dev/null +++ b/test/pptx/metadata-speaker-notes/templated.pptx |
