git.iko.soy/typeable/pandoc
on master help sign in
Treat div with class "notes" as speaker notes in slide formats.

Currently beamer goes to `\note{}`, revealjs to `<aside class="notes">`, and the notes are simply suppressed in other formats. Closes #925.

commit0df7cce37da162c656aa88ecb67788109749668c authorJohn MacFarlane <fiddlosopher@gmail.com> dateSun 13 Oct 2013, 15:36 (13 years ago) parent2ae7f5e
3 files changed+33−3
README+18 src/Text/Pandoc/Writers/HTML.hs+9−2 src/Text/Pandoc/Writers/LaTeX.hs+6−1
README+18
@@ -2731,6 +2731,24 @@ bibliographies:
27312731
27322732 # References {.allowframebreaks}
27332733
2734+Speaker notes
2735+-------------
2736+
2737+reveal.js has good support for speaker notes. You can add notes to your
2738+markdown document thus:
2739+
2740+ <div class="notes">
2741+ This is my note.
2742+
2743+ - It can contain markdown
2744+ - like this list
2745+
2746+ </div>
2747+
2748+To show the notes window, press `s` while viewing the presentation.
2749+Notes are not yet supported for other slide formats, but the notes
2750+will not appear on the slides themselves.
2751+
27342752Literate Haskell support
27352753========================
27362754
src/Text/Pandoc/Writers/HTML.hs+9−2
@@ -421,9 +421,16 @@ blockToHtml opts (Para [Image txt (s,'f':'i':'g':':':tit)]) = do
421421blockToHtml opts (Para lst) = do
422422 contents <- inlineListToHtml opts lst
423423 return $ H.p contents
424−blockToHtml opts (Div attr bs) = do
424+blockToHtml opts (Div attr@(_,classes,_) bs) = do
425425 contents <- blockListToHtml opts bs
426− return $ addAttrs opts attr $ H.div $ nl opts >> contents >> nl opts
426+ let contents' = nl opts >> contents >> nl opts
427+ return $
428+ if "notes" `elem` classes
429+ then case writerSlideVariant opts of
430+ RevealJsSlides -> addAttrs opts attr $ H5.aside $ contents'
431+ NoSlides -> addAttrs opts attr $ H.div $ contents'
432+ _ -> mempty
433+ else addAttrs opts attr $ H.div $ contents'
427434blockToHtml _ (RawBlock f str)
428435 | f == Format "html" = return $ preEscapedString str
429436 | otherwise = return mempty
src/Text/Pandoc/Writers/LaTeX.hs+6−1
@@ -285,7 +285,12 @@ isLineBreakOrSpace _ = False
285285blockToLaTeX :: Block -- ^ Block to convert
286286 -> State WriterState Doc
287287blockToLaTeX Null = return empty
288−blockToLaTeX (Div _ bs) = blockListToLaTeX bs
288+blockToLaTeX (Div (_,classes,_) bs) = do
289+ beamer <- writerBeamer `fmap` gets stOptions
290+ contents <- blockListToLaTeX bs
291+ if beamer && "notes" `elem` classes -- speaker notes
292+ then return $ "\\note" <> braces contents
293+ else return contents
289294blockToLaTeX (Plain lst) =
290295 inlineListToLaTeX $ dropWhile isLineBreakOrSpace lst
291296-- title beginning with fig: indicates that the image is a figure