-
-
Save hepplerj/6c73462327be220fa3be 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
#!/usr/bin/env python | |
from pandocfilters import toJSONFilter, RawInline, Str, Space | |
""" | |
Pandoc filter for Markdown that converts all notes to inline notes. | |
If input notes had multiple paragraphs, the paragraphs are joined | |
by a single space. | |
""" | |
def inlinenotes(k, v, f, meta): | |
if k == 'Note' and f == 'markdown': | |
vlist = v[0]['c'] | |
for d in v[1:]: | |
vlist.append(Space()) | |
vlist.extend(d['c']) | |
return [RawInline('html', '^[')] + vlist + [Str(']')] | |
if __name__ == "__main__": | |
toJSONFilter(inlinenotes) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment