@@ -533,12 +533,10 @@ treatAsImage fp =
533533 ext = map toLower $ drop 1 $ takeExtension path
534534 in null ext || ext `elem` imageExts
535535
536−-- | Convert Pandoc block element to HTML.
537−blockToHtml :: PandocMonad m => WriterOptions -> Block -> StateT WriterState m Html
538−blockToHtml _ Null = return mempty
539−blockToHtml opts (Plain lst) = inlineListToHtml opts lst
540−-- title beginning with fig: indicates that the image is a figure
541−blockToHtml opts (Para [Image attr txt (s,'f':'i':'g':':':tit)]) = do
536+figure :: PandocMonad m
537+ => WriterOptions -> Attr -> [Inline] -> (String, String)
538+ -> StateT WriterState m Html
539+figure opts attr txt (s,tit) = do
542540 img <- inlineToHtml opts (Image attr txt (s,tit))
543541 html5 <- gets stHtml5
544542 let tocapt = if html5
@@ -552,6 +550,23 @@ blockToHtml opts (Para [Image attr txt (s,'f':'i':'g':':':tit)]) = do
552550 [nl opts, img, capt, nl opts]
553551 else H.div ! A.class_ "figure" $ mconcat
554552 [nl opts, img, nl opts, capt, nl opts]
553+
554+-- | Convert Pandoc block element to HTML.
555+blockToHtml :: PandocMonad m => WriterOptions -> Block -> StateT WriterState m Html
556+blockToHtml _ Null = return mempty
557+blockToHtml opts (Plain lst) = inlineListToHtml opts lst
558+blockToHtml opts (Para [Image attr@(_,classes,_) txt (src,tit)])
559+ | "stretch" `elem` classes = do
560+ slideVariant <- gets stSlideVariant
561+ case slideVariant of
562+ RevealJsSlides ->
563+ -- a "stretched" image in reveal.js must be a direct child
564+ -- of the slide container
565+ inlineToHtml opts (Image attr txt (src, tit))
566+ _ -> figure opts attr txt (src, tit)
567+-- title beginning with fig: indicates that the image is a figure
568+blockToHtml opts (Para [Image attr txt (s,'f':'i':'g':':':tit)]) =
569+ figure opts attr txt (s,tit)
555570blockToHtml opts (Para lst)
556571 | isEmptyRaw lst = return mempty
557572 | otherwise = do