Carolling with Pandoc - 'automatic' PowerPoint lyric slides

Photo by David Beale on Unsplash

Converting lyrics (in text/‘markdown’ format) to PowerPoint

Christmas carols and worship songs lyrics are easily (and sometimes freely) available across the Internet.

One source is SongSelect (by CCLI), though SongSelect is not free, but does help congregations support song-writers by paying appropriate royalty fees.

A popular and (almost) universal presentation format is PowerPoint (by Microsoft). Unfortunately, creating song lyric slides from PowerPoint can be a painful and slow process. Lyric slides might only contain two or three lines per slide! So a lot of slides might need to be created for a single song.

Pandoc to the rescue! Pandoc can rapidly convert a text file (such as lyrics) to another format, such as PowerPoint slides!

The gory details are described in the Pandoc manual, but here’s a summary, followed by example files.

  • Create a PowerPoint template
    • As described in the manual, create a default template with pandoc with
      pandoc -o custom-reference.pptx --print-default-data-file reference.pptx
    • Edit the slide master of the created template custom-reference.pptx with PowerPoint.
      • Note that the master needs to be edited, not the slides!
    • There are four slides to edit, the title slide, title and content, section header and two (column) content.
      • The only slide that I really needed to edit for typical lyrics PowerPoints is title and content
      • I moved the title of title and content to the bottom, so it will where I will place copyright information.
      • I restricted the main body (lyrics) of the slide to the top half of the slide.
    • Save the created template. I saved it as .potx PowerPoint template. This template is named pandox_pptx_reference_worship.potx below.
  • Create a lyric file in markdown ‘.md’ format
    • This is ‘just’ a textfile. This file is named below.
    • Separate slides with ---. The --- needs to be preceded and followed by a blank line.
    • ‘#’ titles, in my template, are used to designate copyright information. Titles must be placed at the beginning of the slide.
  • Process the markdown file with pandoc
    • pandoc --to pptx --from markdown+hard_line_breaks --reference-doc pandoc_pptx_reference_worship.potx --output output.pptx
      • the name of my template is pandoc_pptx_reference_worship.potx
      • hard_line_breaks modification to markdown specifies that each newline in the lyrics actually does create a new line!
      • this example creates the PowerPoint file output.pptx

Very small lyrics ‘markdown’ example:

# (C) Chris Tomlin | Ed Cash | George Frideric Handel | Isaac Watts | Matt Gilder

Joy to the world the Lord is come
Let earth receive her King
Let ev'ry heart prepare Him room

And heaven and nature sing
And heaven and nature sing
And heaven and heaven and nature sing

Bonus feature - It is easy to import and convert the ‘markdown’ text file into the lyrics manager of other presentation software, such as Easyworship.

Example files

  • Markdown lyrics file for ‘Joy To The World’
    • includes comments
    • includes a verse in Chinese using the ‘two column’ PowerPoint master template.
  • An example template
    • Text is white bold version of Calibri, with black outlines
    • Slides backgrounds are a very dark blue
    • title and content master template
      • The body/lyrics section is limited to the top of the slide
      • The title is at the bottom of the slide, with a smaller font. Intended to be used for copyright information. Note that the ‘title/copyright’ needs to be at the ‘beginning’ of the slide description.
    • two column master template
      • The title is at the top of the slide
      • the ‘left column’ (for Chinese lyrics) uses a font which is neither outlined nor bold
      • the ‘right column’ (for English lyrics) uses a bold, outlined font.
  • The ‘Joy to the World’ PowerPoint created by Pandoc
David Fong
David Fong
Lead doctor, Kensington site, coHealth

My interests include sustainable development in low-resource populations, teaching and the uses of monitoring and evaluation in clinical practice.