git.iko.soy/typeable/pandoc
on master help sign in
Fix --toc-depth regression in 2.8.
0b54d62John MacFarlane
src/Text/Pandoc/Writers/Shared.hs+3−3
@@ -407,9 +407,9 @@ toTableOfContents opts bs =
407sectionToListItem :: WriterOptions -> Block -> [Block]
407sectionToListItem :: WriterOptions -> Block -> [Block]
408sectionToListItem opts (Div (ident,_,_)
408sectionToListItem opts (Div (ident,_,_)
409 (Header lev (_,classes,kvs) ils : subsecs))
409 (Header lev (_,classes,kvs) ils : subsecs))
410+ | lev <= writerTOCDepth opts
410− | not (isNothing (lookup "number" kvs) && "unlisted" `elem` classes)
411+ , not (isNothing (lookup "number" kvs) && "unlisted" `elem` classes)
411− = Plain headerLink : [BulletList listContents | not (null listContents)
412+ = Plain headerLink : [BulletList listContents | not (null listContents)]
412− , lev < writerTOCDepth opts]
413 where
413 where
414 num = fromMaybe "" $ lookup "number" kvs
414 num = fromMaybe "" $ lookup "number" kvs
415 addNumber = if T.null num
415 addNumber = if T.null num
test/command/5967.mdnew file+15
@@ -0,0 +1,15 @@
1+```
2+% pandoc --toc --toc-depth=3 -s -t plain
3+# One
4+## Two
5+#### Four
6+^D
7+- One
8+ - Two
9+
10+One
11+
12+Two
13+
14+Four
15+```