Created
December 8, 2014 17:41
-
-
Save mpickering/b9fceb4cf9f11e116b49 to your computer and use it in GitHub Desktop.
Pandoc filter to remove comments
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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