(Ooops probably answered Denis only and not the group. Here we go again!)
AFAICT filters are document AST to AST transformations. In this Python library, docs (Pandoc instances) represent this AST, so a typical AST (in-place) transform would be:
import pandoc
from pandoc.types import *
def uppercase(doc):
for elt in pandoc.iter(doc):
if isinstance(elt, Str):
elt[0] = elt[0].upper() # elt: Str(Text)
If you need to make a markdown to markdown transformation instead, you read the input markdown, transform it then write it back:
>>> markdown = "Hello world!"
>>> doc = pandoc.read(markdown)
>>> uppercase(doc)
>>> markdown = pandoc.write(doc)
>>> print(markdown)
HELLO WORLD!
There are more examples here:
https://boisgera.github.io/pandoc/examples/
and a documentation of common patterns here:
https://boisgera.github.io/pandoc/cookbook/
Cheers,
Sébastien
--
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org.
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/de1fd005-0d0d-49a2-86cc-5a72c764835dn%40googlegroups.com.