bmschmidt / pandoc-tools

Pandoc tools for javascript, including a rollup importer
MIT License
3 stars 1 forks source link

Add ability to modify pandoc command #2

Open lduktus opened 1 year ago

lduktus commented 1 year ago

One way would be to pass arbitrary arguments to the pandoc command. I personally overwrote it by adding -d default.yaml. As I was trying to add a custom cite component for pandoc-svelte-components I can also place a default bibliography and csl file relative to the default.yaml.

bmschmidt commented 1 year ago

This makes a lot of sense as a request, but I've got to think a little about the best way to define it.

Because one of my medium term goals with this library is to support serverless or even in-browser builds using wasm-compiled versions of pandoc where filesystem routing may be complicated, I think the best api here would be to allow passing arguments as a javascript object. That object would have exactly the same syntax as default.yml--i.e., you could just yaml.load() a default.yml file and pass it as an arg.

The challenge is that the cli and defaults.yml have subtly different syntaxes. In wasm-land this could be an issue because we won't be able to simply unpack the json and turn it into arguments; and I'm simply unsure of how to pass a synthetic file to wasm.

lduktus commented 1 year ago

I see, I would like to support somehow, but I haven't a lot of experience with both JS and OS contributions in general and even less with wasm. From a user perspective I like two things about the default.yaml approach:

I am sure you know this already, but here is the link to pandocs documentation about default files: https://pandoc.org/MANUAL.html#defaults-files