Skip to content

Instantly share code, notes, and snippets.

@mpickering
Created December 8, 2014 17:41
Show Gist options
  • Save mpickering/b9fceb4cf9f11e116b49 to your computer and use it in GitHub Desktop.
Save mpickering/b9fceb4cf9f11e116b49 to your computer and use it in GitHub Desktop.
Pandoc filter to remove comments
module Main where
import Text.Pandoc.JSON
import Data.List
main = toJSONFilter removeComments
removeComments :: Block -> [Block]
removeComments e@(RawBlock (Format "html") s) = if isComment s then [] else [e]
removeComments e = [e]
isComment :: String -> Bool
isComment = isPrefixOf "<!--"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment