Skip to content

Instantly share code, notes, and snippets.

@lierdakil
Created September 6, 2015 06:06
Show Gist options
  • Save lierdakil/3e818cd7f972ccc7723d to your computer and use it in GitHub Desktop.
Save lierdakil/3e818cd7f972ccc7723d to your computer and use it in GitHub Desktop.
import Text.Pandoc.JSON
import System.Process
import Text.HTML.TagSoup
main :: IO ()
main = toJSONFilter dotToSvg
dotToSvg :: Block -> IO Block
dotToSvg x@(CodeBlock (_, cls, _) text)
| "dot" `elem` cls = do
res <- readProcess "dot" ["-Tsvg"] text
return $ RawBlock (Format "html") $ "<p>" ++ (renderTags . parseTags) res ++ "</p>"
| otherwise = return x
dotToSvg x = return x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment