Created
May 31, 2020 01:31
-
-
Save puffnfresh/3bf96f282241c61ce486076b720045a3 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/env nix-shell | |
#!nix-shell -p "haskellPackages.ghcWithPackages (p: [ p.pandoc p.pandoc-types ])" -i runhaskell | |
{-# LANGUAGE OverloadedStrings #-} | |
import Text.Pandoc.JSON | |
import Text.Pandoc.Shared (tshow) | |
import Data.Text as T | |
main :: IO () | |
main = toJSONFilter latexBlock | |
latexBlock :: Block -> Block | |
latexBlock x@(CodeBlock (_, l, _) b) = | |
if l == ["agda"] | |
then RawBlock "latex" (T.unlines ["\\begin{code}", b, "\\end{code}"]) | |
else x | |
latexBlock x = x |
This file contains hidden or 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
pandoc Naturals.lagda.md -t latex -f gfm -F agda-blocks.hs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Requires specifying Agda as the language in the Markdown: