如何使用YAML块指定pandoc的markdown扩展? [英] How can I specify pandoc's markdown extensions using a YAML block?
问题描述
Pandoc的降价让您指定扩展名,了解如何处理降价:
Pandoc's markdown lets you specify extensions for how you would like your markdown to be handled:
通过将+EXTENSION
或-EXTENSION
附加到格式名称,可以分别启用或禁用Markdown语法扩展.因此,例如,
markdown_strict+footnotes+definition_lists
是启用脚注和定义列表的严格降价,而markdown-pipe_tables+hard_line_breaks
是没有管道表和硬换行符的pandoc降价.
Markdown syntax extensions can be individually enabled or disabled by appending
+EXTENSION
or-EXTENSION
to the format name. So, for example,markdown_strict+footnotes+definition_lists
is strict markdown with footnotes and definition lists enabled, andmarkdown-pipe_tables+hard_line_breaks
is pandoc’s markdown without pipe tables and with hard line breaks.
我的具体问题
对于给定的pandoc转换,例如,我在源中使用网格表 :
pandoc myReport.md --from markdown+pipe_tables --to latex -o myReport.pdf
如何编写 pandoc YAML块以完成相同的操作(指定我的源包含表格吗?)
How can I write a pandoc YAML block to accomplish the same thing (specifying that my source contains grid tables?)
如何使用pandoc YAML打开和关闭扩展?
How can I turn extensions on and off using pandoc YAML?
- 可以使用YAML设置命令行参数吗元数据-这是关于如何指定输出选项的内容,但是我试图将我输入的结构告诉pandoc
- 我可以使用YAML标头选项控制什么pandoc?-回答者提到pandoc的模板,但 latex输出模板或 markdown模板表示的任何形式
grid_tables
的选项.因此,从这些答案中我还不清楚,对模板的了解将如何帮助我弄清楚如何构造我的YAML.
- Can I set command line arguments using the YAML metadata - This one deals with how to specify output options, but I'm trying to tell pandoc about the structure of my input
- What can I control with YAML header options in pandoc? - Answerers mention pandoc's templates, but neither the latex output template nor the markdown template indicate any sort of option for
grid_tables
. So, it's not clear to me from these answers how knowing about the templates will help me figure out how to structure my YAML.
pandoc总是有可能不被设计为允许您在YAML中指定这些扩展名.虽然,我希望是这样.
It's always possible that pandoc isn't designed to let you specify those extensions in the YAML. Although, I'm hoping it is.
推荐答案
您可以使用Markdown变体在Rmarkdown文档中执行此操作.本质上,您是在.Rmd
文件开头的YAML
标题栏中的variant
选项中输入扩展名.
You can use Markdown Variants to do this in an Rmarkdown document. Essentially, you enter your extensions into a variant
option in the YAML
header block at the start of the your .Rmd
file.
例如,要使用网格表,在YAML
标头块中应具有以下内容:
For example, to use grid tables, you have something like this in your YAML
header block:
---
title: "Habits"
author: John Doe
date: March 22, 2005
output: md_document
variant: markdown+grid_tables
---
---
title: "Habits"
author: John Doe
date: March 22, 2005
output: md_document
variant: markdown+grid_tables
---
然后,您可以在pandoc
中直接输入以下内容,直接在pandoc
中编译为PDF:
Then you can compile to a PDF directly in pandoc
by typing in your command line something like:
pandoc yourfile.md -o yourfile.pdf
有关RStudio中markdown变体的更多信息: http://rmarkdown.rstudio.com/markdown_document_format .html#markdown_variants
For more information on markdown variants in RStudio: http://rmarkdown.rstudio.com/markdown_document_format.html#markdown_variants
有关RStudio中markdown/Rmarkdown中Pandoc扩展的更多信息: http://rmarkdown.rstudio.com/authoring_pandoc_markdown.html#pandoc_markdown
For more information on Pandoc extensions in markdown/Rmarkdown in RStudio: http://rmarkdown.rstudio.com/authoring_pandoc_markdown.html#pandoc_markdown
这篇关于如何使用YAML块指定pandoc的markdown扩展?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!