Created
September 6, 2015 06:06
-
-
Save lierdakil/3e818cd7f972ccc7723d to your computer and use it in GitHub Desktop.
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
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