Please for arbitrary parameters to pandoc

Hi,
This is a plea to allow passing arbitrary parameters to pandoc, and on a per file/frontmatter basis too. The original github issue that led to making pandoc an external helper (here) touches on the question of arbitrary arguments, and that point was rejected. Somewhere else someone also raised a security issue, due to the potential of running arbitrary code.

I want to ask again the feature of passing arbitrary arguments, because current pandoc is like the neglected third child in the helper family, you can’t do :poop: with it currently :sweat_smile:.
You can only use it for mathml, while it could generate literally any exotic output from any exotic markup hugo doesn’t process natively.

A friend of mine died a few months ago and left me his intellectual property to manage, including a few books. I intend to create critical editions, and output both TEI XML and HTML+RDFa (the latter for a static website) from a pandoc basis (much fenced divs and bracketed spans). Or more likely “Djot” , the new kid in the block). Getting all that from renderhooks would be a nightmare.

I use a shim but this sucks, because the semantic structure of the books requires different lua filters or default file. So the only practical solutions currently are either a very long, hard to read lua filter branching depending on the metadata, or just invoking pandoc before hugo. Both displease me immensely.

I will add, that the alleged security risk of running arbitrary code argued since 2019 (!) in Configure external helpers via output formats · Issue #6089 · gohugoio/hugo · GitHub is dubious to say the least: what stops anyone from naming a random script as “pandoc” in the PATH and then running arbitrary code, like I did ? Nothing. The user is not a child, let us not treat him as one.

Hugo is not only used by single persons and private developers. In a bigger organization, security is important. And there, you wouldn’t one someone installing an executable under a false name.

I don’t understand, like I said can’t we already do that by hiding a script under ~/.local/bin/pandoc ? If anything security suffers when you force the user to rely on this hack to use his parameters. Beside… I don’t know much about the corporate world, but aren’t companies which care for that already likely to run hugo in a sandbox and control the environment anyway ?

Since it would take barely 30 lines of Go (according to the pull request I read) to get the arbitrary parameters, what about providing two editions, one super secure and shackled for companies, the other unlocked at our own risk. Then everyone is satisfied, with comparatively little effort, but a hell of a lot more power.