git.iko.soy/typeable/pandoc
on master help sign in
Fix --toc-depth regression in 2.8.

Closes #5967.

commit0b54d6282bb89a71433043857f4983668f9a4beb authorJohn MacFarlane <jgm@berkeley.edu> dateSat 7 Dec 2019, 14:20 (7 years ago) parent5295607
2 files changed+18−3
src/Text/Pandoc/Writers/Shared.hs+3−3 test/command/5967.md+15
src/Text/Pandoc/Writers/Shared.hs+3−3
@@ -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
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+```