(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 Le samedi 4 décembre 2021 à 15:06:10 UTC+1, denis...-NSENcxR/0n0@public.gmane.org a écrit : > Hi Sebastian > Looks interesting. But I don't undertake how you'd use that as an > alternative to a filter. Can you give an example? > Denis > > > > ________________________________________ > Von: pandoc-...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org im Auftrag > von Sébastien Boisgérault > Gesendet: Samstag, 4. Dezember 2021 14:20:03 > An: pandoc-discuss > Betreff: Pandoc Document Model in Python > > Hi everyone, > > I have just released the 2.0 version of a pandoc python library which > exposes the Pandoc document model to Python : > > https://github.com/boisgera/pandoc#-overview > > The main goal is to enable all kinds of analysis, generation and > transformation of documents with Python (roughly speaking, an alternative > to pandoc filters); it is not to convert from one format to another (it can > do it, but so can the standard pandoc command-line tool). > > Feedback welcome ! > > 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-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org pandoc-discus...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/pandoc-discuss/f224cd2c-7d68-40b4-a855-7d4d0d7aa442n%40googlegroups.com > < > https://groups.google.com/d/msgid/pandoc-discuss/f224cd2c-7d68-40b4-a855-7d4d0d7aa442n%40googlegroups.com?utm_medium=email&utm_source=footer > >. > -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@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.