我可以在Pandoc Markdown文档中指定命令行选项吗? [英] Can I specify command line options in a Pandoc Markdown document?

查看:146
本文介绍了我可以在Pandoc Markdown文档中指定命令行选项吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有时,*.md文件需要(由于其内容)一组特定的命令行选项,而与所需的输出格式或其他更可选的命令行选项无关.例如,当文档包含pandoc-fignos样式的图形标记时,当想要有意义的非中间输出时,总是需要--filter pandoc-fignos.

Sometimes, a *.md file requires (due to its content) a certain set of command line options regardless of the desired output format or of other, more optional command line options. E.g., when the document contains pandoc-fignos-style figure markup, --filter pandoc-fignos will always be required when wanting meaningful non-intermediate output.

我不必记住我的哪个Pandoc文档需要哪些选项,而是可以在文件本身内声明任意命令行选项,例如在YAML元数据中?还是每个我可以设置的选项都有一个对应的元数据字段. (如果是后者,我如何找出这些字段,例如--filter对应的字段是什么?)

Instead of having to remember which of my Pandoc documents requires what options, can I declare arbitrary command line options within the file itself, e.g. inside the YAML metadata? Or is there a corresponding metadatafield for each and every option that I could set instead. (If the latter, how can I find out about those field, e.g., what would be the corresponding field to --filter?)

我正在使用Ubuntu 16.04 xenial apt存储库中的pandoc 1.16.0.2,但如有必要,可以切换到更高版本.

I'm using pandoc 1.16.0.2 from the Ubuntu 16.04 xenial apt repo, but could switch to a later version if necessary.

  • This answer to Can I set command line arguments using the YAML metadata says something like this is possible with panzer, a wrapper around pandoc. But that was two years ago and another answer to that question mentions that some changes in that regard were planned in pandoc:

此解决方案 [在YAML中设置模板特定的变量] 的问题在于它仅适用于某些输出 格式.我以为我已经在pandoc邮件列表上阅读过某处 我们很快就能按照预期在YAML块中使用元数据 (即作为参数而不是变量),但是我找不到它 不再,所以也许很快不会发生.

The trouble with this solution [setting template-specific variables in the YAML] is that it only works with some output format. I thought I had read somewhere on the pandoc mailing-list that we soon would be able to use metadata in YAML blocks as intended (ie. as arguments rather than variables), but I can't find it anymore, so maybe it won't happen very soon.

所以我想知道pandoc本身现在是否可以做到这一点.

So I'm wondering whether pandoc itself can do this now.

推荐答案

从pandoc 2.3开始,这仍然是不可能的.请参见跟踪此请求的问题.从概念上讲,pandoc必须两次查看YAML才能做到这一点,因此不太可能实现.

As of pandoc 2.3, this is still not possible. See the issue tracking this request. Conceptually, pandoc would have to look at the YAML twice to do that, so it's unlikely this will be implemented.

但是,您可以使用以下任何包装器:

However, you can use any of the following wrappers:

  • panrun minimal, no-dependencies script
  • panzer
  • pandocomatic

这篇关于我可以在Pandoc Markdown文档中指定命令行选项吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆