Is there is an equivalent of the identity transform for Lua Filters for Pandoc available anywhere?
This would be a useful starting point for experimentation, assuming such an identity transform explicitly defined all possible function 'slots'.
For context: my use-case here is to extract specific parts of Markdown documents - mostly codeblocks - and I want to ignore everything else.
Identity transform for the
Strongelement:Or if you don't need multiple filter runs, you can do the shorthand:
You can return
nilfor elements that you want to filter out. For example removing allStrongelements would be:But there are quite a lot of different elements.
So perhaps what you should do is do
pandoc -t jsonand pipe that to a program in your favourite programming language and extract all code blocks. See pandoc filter tools for some packages, but if you're only interested in code blocks at the top level (and you don't need to recursively walk the tree), then no package should be needed.But it's true, you can achieve the same thing with a lua filter:
Example usage (assuming filter code is in 'filter_codeblock.lua', and markdown document is 'main.md')