I wrote a filter that uses the Pandoc AST. It first reads the Logseq Markdown using Pandoc, processes it to smooth over some idiosyncrasies of logseq itself and of my workflow at the time, and writes out Pandoc again. It’s not documented, and might not do what you want, but it might be an example to build on.