如何使用yaml标头覆盖默认的pandoc选项,以在rmarkdown中指定Github Markdown?

问题描述

我正在尝试使用Github格式的Markdown(GFM)生成MS Word文档。来自pandoc documentation

-来自gfm

会做我想要的。

但是当我在yaml标头中指定它时,它会添加它,但不会删除markdown的认--from参数。我不知道该参数的来源形式,但我希望能够覆盖它。

我的标题没有pandoc_args

---
title: "Jonny B. Good"
output: 
  word_document:
    reference_docx: "template.docx"
---

生成的pandoc命令为
/usr/local/bin/pandoc +RTS -K512m -RTS rmarkdown_document.utf8.md --to docx --from markdown+autolink_bare_uris+tex_math_single_backslash --output rmarkdown_document.docx --highlight-style tango --reference-doc template.docx --lua-filter /Library/Frameworks/R.framework/Versions/4.0/Resources/library/rmarkdown/rmd/lua/pagebreak.lua

现在,如果我像这样添加--from参数

---
title: "Jonny B. Good"
output: 
  word_document:
    reference_docx: "template.docx"
    pandoc_args: ["--from","gfm"]
---

生成的pandoc命令为

/usr/local/bin/pandoc +RTS -K512m -RTS rmarkdown_document.utf8.md --to docx --from markdown+autolink_bare_uris+tex_math_single_backslash --output rmarkdown_document.docx --highlight-style tango --reference-doc template.docx --lua-filter /Library/Frameworks/R.framework/Versions/4.0/Resources/library/rmarkdown/rmd/lua/pagebreak.lua --from gfm

它将参数添加到命令行,但是仅使用第一个--from。 MS Word文档看起来像

enter image description here

有没有办法覆盖认的--from选项?我的Google搜索未返回任何试图完全执行我想做的事情的人,但是似乎pandoc_args是我应该这样做的方式。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)