4

I'm trying to use Github Formatted Markdown(GFM) to generate an MS Word document. From the pandoc documentation :

--from gfm

will do what I want.

But when I specify it in my yaml header, it adds it but doesn't remove the default --from parameter for markdown. I don't know where that parameter is sourced form, but I'd like to be able to override it.

My header without pandoc_args

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

The generated pandoc command is
/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

Now if I add my --from parameter like so

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

The generated pandoc command is

/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

It adds the parameter to the command line, but only the first --from is honored. The MS Word document looks like

enter image description here

Is there a way that I override the default --from option ? My google searches haven't returned anyone trying to do exactly what I want to do, but it seems that pandoc_args is the way that I should do it.

majorgear
  • 311
  • 3
  • 12

0 Answers0