diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs index 6b9856b10..095d55c0e 100644 --- a/src/Text/Pandoc/Writers/HTML.hs +++ b/src/Text/Pandoc/Writers/HTML.hs @@ -676,13 +676,15 @@ blockToHtml opts (Div (ident, "section":dclasses, dkvs) let attr = (ident, classes', dkvs) if titleSlide then do - t <- addAttrs opts attr $ secttag $ header' <> titleContents + t <- addAttrs opts attr $ + secttag $ nl opts <> header' <> nl opts <> titleContents <> nl opts return $ - (if slideVariant == RevealJsSlides && not (null innerSecs) - -- revealjs doesn't like more than one level of section nesting: - {- REMOVED && isNothing mbparentlevel -} - then H5.section - else id) $ nl opts <> t <> nl opts <> + -- ensure 2D nesting for revealjs, but only for one level; + -- revealjs doesn't like more than one level of nseting + (if slideVariant == RevealJsSlides && not (null innerSecs) && + level == slideLevel - 1 + then \z -> H5.section (nl opts <> z) + else id) $ t <> nl opts <> if null innerSecs then mempty else innerContents <> nl opts diff --git a/test/command/6030.md b/test/command/6030.md new file mode 100644 index 000000000..943150432 --- /dev/null +++ b/test/command/6030.md @@ -0,0 +1,35 @@ +``` +% pandoc -t revealjs --slide-level=3 +# One + +One + +## Two + +Two + +### Three + +Three + +#### Four + +Four +^D +
+

One

+

One

+
+
+
+

Two

+

Two

+
+
+

Three

+

Three

+

Four

+

Four

+
+
+```