如何使用YAML块指定pandoc的markdown扩展? [英] How can I specify pandoc's markdown extensions using a YAML block?

查看:166
本文介绍了如何使用YAML块指定pandoc的markdown扩展?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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, and markdown-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?

  • 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屋!

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