Is there any way to make a bit of text bold using the 'pandocfilters' package (https://github.com/jgm/pandocfilters/tree/master/examples) in pandoc?
As a minimal working example, suppose I have a markdown file ('foo.md'):
foobar.
I want to write 'filter.py' to be something like
from pandocfilters import toJSONFilter, Str,Emph
def boldify(key, val, fmt, meta):
if key == 'Str' and "foo" in val:
# this is the part I can't don't know how to do
# I would like to make the value be bold
return [Emph(val)]
if __name__ == '__main__':
toJSONFilter(boldify)
So we run the whole thing like
pandoc 'foo.md' --filter='filter.py' -o 'foo.docx'
Using this, I get the following error:
pandoc: Error in $.blocks[0].c[0].c: expected [a], encountered String
CallStack (from HasCallStack):
error, called at pandoc.hs:144:42 in main:Main
Any help would be appreciated.