I guess the lack of documentation reflects the fact that knit:
(and the elusive pre_knit:
functionality I was after) isn't something one is expected to use. For what it's worth I think it is a workable strategy with the existing toolchain, i.e. in one knit
click I get the desired transformation
but it feels very hackish. I've been reflecting on the whole Rmd toolchain, and in my view instead of pursuing this pre_knit
tag further, with a setup like this
I would rather take a fresh look altogether at the full potential of a pandoc-centric toolchain,
pandoc filters aren't easy to get into (and the pandocfilters
package is seriously lacking in documentation), but this feels like a robust and powerful approach, by-passing many current limitations in knitr and rmarkdown (because basically R could do literally anything between both ASTs, with full access to the document's structure – which node is code, text, header, etc.)