I am trying to tell pandoc to use a custom pandocfilter written in python. I am on a MacBook M1 and therefore there is a 2.7 and a homebrewed 3.9.7 version of python installed.
For some reason the pandocfilter module is not found despite being installed correctly.
This is the script I'm trying to use:
#!/usr/bin/env python3
from pandocfilters import toJSONFilter, Str
import re
def replace(key, value, format, meta):
if key == 'Str':
if '[[' in value:
new_value = value.replace('[[', '')
return Str(new_value)
if ']]' in value:
new_value = value.replace(']]', '')
return Str(new_value)
if __name__ == '__main__':
toJSONFilter(replace)
/usr/bin/env python3
points to the correct python version so I have no clue where the issue may be.
I'm looking forward for any help!