mrded / pandoc-as-a-service

If you need to convert text from one markup format into another, pandoc-as-a-service is your swiss-army knife.
GNU General Public License v2.0
68 stars 16 forks source link

Allow specifying pandoc options, e.g. `--standalone --mathjax` #4

Open cben opened 9 years ago

cben commented 9 years ago

Nice project! Added to pandoc wiki I was happy to discover you already allow pandoc syntax extensions e.g. text/markdown_github-blank_before_header+tex_math_dollars+tex_math_single_backslash :-) But many aspects of pandoc's input and output are not covered by "from" and "to" formats, so I'd like to also be able to pass extra command-line options.

Allowing arbitrary command line options is probably unsafe (multiple ways to read local files like /etc/passwd, filters might allow remote code execution...). I don't see an easy way to know what's secure, except by whitelist (to be extended by PRs when people want more). And instead of trying to parse a given command line, it's simpler to accept structured options (e.g. {standalone: true} or &standalone=true) and generate a command line. => All this leads to inventing yet another complex pandoc API, that won't 1:1 match other pandoc service APIs... Oh well. Prior arts: http://www.docverter.com/api#Full-Option-Reference, http://yihui.name/knitr/demo/pandoc/ (see Config File), https://github.com/alphabetum/pandoc-ruby#usage

nichtich commented 9 years ago

I'd choose to implement options equal to docverter because its a web api as well and pandoc-as-a-service can be used as open source alternative.