Skip to content

Instantly share code, notes, and snippets.

@mpickering
Created January 19, 2015 23:36
Show Gist options
  • Save mpickering/ffa67748a9ca7a2ac7c8 to your computer and use it in GitHub Desktop.
Save mpickering/ffa67748a9ca7a2ac7c8 to your computer and use it in GitHub Desktop.
Pandoc filter where headers at levels lower than 3 are not numbered.
module Filter where
import Text.Pandoc.JSON
import Text.Pandoc.Definition
main :: IO ()
main = toJSONFilter scrub
scrub :: Block -> Block
scrub h@(Header level (uid, cs, kvs) title)
| level >= 3 = Header level (uid, "unnumbered" : cs, kvs) title
| otherwise = h
scrub b = b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment