@@ -407,9 +407,9 @@ toTableOfContents opts bs =
407407sectionToListItem :: WriterOptions -> Block -> [Block]
408408sectionToListItem opts (Div (ident,_,_)
409409 (Header lev (_,classes,kvs) ils : subsecs))
410− | not (isNothing (lookup "number" kvs) && "unlisted" `elem` classes)
411− = Plain headerLink : [BulletList listContents | not (null listContents)
412− , lev < writerTOCDepth opts]
410+ | lev <= writerTOCDepth opts
411+ , not (isNothing (lookup "number" kvs) && "unlisted" `elem` classes)
412+ = Plain headerLink : [BulletList listContents | not (null listContents)]
413413 where
414414 num = fromMaybe "" $ lookup "number" kvs
415415 addNumber = if T.null num