git.iko.soy/typeable/pandoc
on master help sign in
Treat div with class "notes" as speaker notes in slide formats.
0df7cceJohn MacFarlane
@@ -2731,6 +2731,24 @@ bibliographies:
2731
2731
2732 # References {.allowframebreaks}
2732 # References {.allowframebreaks}
2733
2733
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+
2734Literate Haskell support
2752Literate Haskell support
2735========================
2753========================
2736
2754
src/Text/Pandoc/Writers/HTML.hs+9−2
@@ -421,9 +421,16 @@ blockToHtml opts (Para [Image txt (s,'f':'i':'g':':':tit)]) = do
421blockToHtml opts (Para lst) = do
421blockToHtml opts (Para lst) = do
422 contents <- inlineListToHtml opts lst
422 contents <- inlineListToHtml opts lst
423 return $ H.p contents
423 return $ H.p contents
424−blockToHtml opts (Div attr bs) = do
424+blockToHtml opts (Div attr@(_,classes,_) bs) = do
425 contents <- blockListToHtml opts bs
425 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'
427blockToHtml _ (RawBlock f str)
434blockToHtml _ (RawBlock f str)
428 | f == Format "html" = return $ preEscapedString str
435 | f == Format "html" = return $ preEscapedString str
429 | otherwise = return mempty
436 | otherwise = return mempty
src/Text/Pandoc/Writers/LaTeX.hs+6−1
@@ -285,7 +285,12 @@ isLineBreakOrSpace _ = False
285blockToLaTeX :: Block -- ^ Block to convert
285blockToLaTeX :: Block -- ^ Block to convert
286 -> State WriterState Doc
286 -> State WriterState Doc
287blockToLaTeX Null = return empty
287blockToLaTeX Null = return empty
288+blockToLaTeX (Div (_,classes,_) bs) = do
289+ beamer <- writerBeamer `fmap` gets stOptions
288−blockToLaTeX (Div _ bs) = blockListToLaTeX bs
290+ contents <- blockListToLaTeX bs
291+ if beamer && "notes" `elem` classes -- speaker notes
292+ then return $ "\\note" <> braces contents
293+ else return contents
289blockToLaTeX (Plain lst) =
294blockToLaTeX (Plain lst) =
290 inlineListToLaTeX $ dropWhile isLineBreakOrSpace lst
295 inlineListToLaTeX $ dropWhile isLineBreakOrSpace lst
291-- title beginning with fig: indicates that the image is a figure
296-- title beginning with fig: indicates that the image is a figure