Search code examples
haskellpandocreveal.jshakyll

How to generate reveal.js slides from pandoc programmatically?


I am using Hakyll to generate my blog and would like to integrate in the generated web site some slides from talks I give. This should be as simple as defining you own custom pandocCompiler with adequate configuration and indeed I manage to do it.

Here is the compiler definition:

 pandocSlideCompiler :: Compiler (Item String)
 pandocSlideCompiler = pandocCompilerWith defaultHakyllReaderOptions writeHtmlSlide
   where
     writeHtmlSlide = defaultHakyllWriterOptions { writerIncremental = True
                                                 , writerSectionDivs = False
                                                 , writerVariables = [("theme", "beige")]
                                                 , writerSlideLevel = Just 2
                                                 , writerSlideVariant = RevealJsSlides
                                                 , writerIgnoreNotes = True
                                                 }

This works but the generated slides are not correctly formatted: Each slide is generated as div whereas reveal.js expects a section.

Here is the command-line equivalent I would like to implement:

pandoc --slide-level 2 --variable theme=beige -i -s -o slides.html --template=template-revealjs.html -t revealjs slides.md

My question is then: Which options from Text.Pandoc.Options shall I use to produce the same result as my command-line?


Solution

  • I think you need to add writerHtml5 = True, as can be seen in the pandoc source commandline args parsing and HTML writer...