@@ -160,7 +160,11 @@ tableOfContents _ [] = return noHtml
160160tableOfContents opts sects = do
161161 let opts' = opts { writerIgnoreNotes = True }
162162 contents <- mapM (elementToListItem opts') sects
163− return $ thediv ! [prefixedId opts' "TOC"] $ unordList $ catMaybes contents
163+ let tocList = catMaybes contents
164+ return $ thediv ! [prefixedId opts' "TOC"] $
165+ if null tocList
166+ then noHtml
167+ else unordList tocList
164168
165169-- | Convert section number to string
166170showSecNum :: [Int] -> String