从Rmd转换为md时,避免转义下划线和包围URL

时间:2017-03-22 19:24:37

标签: r markdown r-markdown pandoc

我正在尝试将RMarkdown文件转换为Markdown,以便发布到Github网页(jekyll)网站。由于图标题需要扩展,我使用jekyll主题建议的方法来添加标题。问题是,当从.Rmd解析到.md时,图形的代码不会逐字记录,并且会以破坏jekyll的方式进行解析。

拿这个MWE:

---
title: "MWE"
output: 
  md_document:
    preserve_yaml: TRUE
    variant: markdown_strict+backtick_code_blocks
---
## Test title

Text goes here.

{% include figure image_path="https://upload.wikimedia.org/wikipedia/commons/4/4e/Macaca_nigra_self-portrait_large.jpg" caption="Caption goes here." %}

这被解析为:

---
title: "MWE"
output: 
  md_document:
    preserve_yaml: TRUE
    variant: markdown_strict+backtick_code_blocks
---

Test title
----------

Text goes here.

{% include figure
image\_path="<https://upload.wikimedia.org/wikipedia/commons/4/4e/Macaca_nigra_self-portrait_large.jpg>"
caption="Caption goes here." %}

请注意大括号内末尾的文本,特别是image_path中的下划线现在已转义,并且URL被括起来。我想逐字记录这段代码:

{% include figure image_path="https://upload.wikimedia.org/wikipedia/commons/4/4e/Macaca_nigra_self-portrait_large.jpg" caption="Caption goes here." %}

我正在使用R v3.3.3rmarkdown v1.2pandoc v1.17.2和RStudio v1.0.136。有什么建议吗?

0 个答案:

没有答案