diff options
-rw-r--r-- | src/Text/Pandoc/Writers/HTML.hs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs index 7d6462148..cca65751f 100644 --- a/src/Text/Pandoc/Writers/HTML.hs +++ b/src/Text/Pandoc/Writers/HTML.hs @@ -160,7 +160,11 @@ tableOfContents _ [] = return noHtml tableOfContents opts sects = do let opts' = opts { writerIgnoreNotes = True } contents <- mapM (elementToListItem opts') sects - return $ thediv ! [prefixedId opts' "TOC"] $ unordList $ catMaybes contents + let tocList = catMaybes contents + return $ thediv ! [prefixedId opts' "TOC"] $ + if null tocList + then noHtml + else unordList tocList -- | Convert section number to string showSecNum :: [Int] -> String |