Skip to content

Instantly share code, notes, and snippets.

@scoavoux
Created February 16, 2016 22:33
Show Gist options
  • Save scoavoux/0b56c20067541b1a07ad to your computer and use it in GitHub Desktop.
Save scoavoux/0b56c20067541b1a07ad to your computer and use it in GitHub Desktop.
pandoc filter to pass raw latex comments, to bypass the %-escaping
#!/usr/bin/env python
# proposed this as an answer here: http://stackoverflow.com/a/35444147/4132844
from pandocfilters import toJSONFilter, RawInline
def comments(k, v, f, meta):
if k == 'Str' and v in ['%TC:ignore','%TC:endignore']:
return RawInline('latex', v)
if __name__ == "__main__":
toJSONFilter(comments)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment