如何以编程方式从 pandoc 生成 reveal.js 幻灯片?

How to generate reveal.js slides from pandoc programmatically?

我正在使用 Hakyll 生成我的博客,并希望在生成的网站中集成我发表的演讲中的一些幻灯片。这应该就像定义您自己的自定义 pandocCompiler 一样简单,并具有足够的配置,事实上我设法做到了。

编译器定义如下:

 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
                                                 }

这有效,但生成的幻灯片格式不正确:每张幻灯片生成为 div 而 reveal.js 期望 section.

这是我想要实现的等效命令行:

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

我的问题是:我应该使用 Text.Pandoc.Options 中的哪些选项来产生与我的命令行相同的结果?

我认为你需要添加 writerHtml5 = True,正如在 pandoc 源代码中看到的 commandline args parsing and HTML writer...