Overview
parseSpeakerNotes parses a markdown string into an array of speaker notes, one per slide. Slides are separated by --- on its own line.
Function Signature
Parameters
The markdown content containing speaker notes separated by
---.If
true, removes a leading section that is a single markdown heading (# Title). Use when the file starts with a document title that shouldn’t be treated as slide notes.Returns
Array of speaker notes where indices map to slides:
notes[0] = slide 1, notes[1] = slide 2, etc. Empty sections produce null (no notes for that slide).Markdown Format
Sections are separated by--- on its own line:
Results
- Index 0: “Welcome everyone. This is the opening slide.”
- Index 1: “Talk about the base container here.”
- Index 2:
null(empty section) - Index 3: “Slide 4 notes. Slide 3 had none.”
Usage Examples
Basic parsing
Strip leading title
notes.md starts with:
stripLeadingTitle: true, the ”# My Presentation” section is removed and “First slide notes here” becomes notes[0].
Use with SlideDeck
Implementation Details
- Splits on
/^---$/m(regex matches---on its own line) - Trims each section and converts empty strings to
null - When
stripLeadingTitleis true, checks if the first section matches/^#+\s+.+$/(one or more#followed by text) - Empty sections between separators become
null