如何使用 RStudio (knitr?) 恢复到简单的图像标题降价格式?

How Do I Get Back to a Simple Markdown Format for Image Captions Using RStudio (knitr?)?

我刚刚更新了几个 R 包,它似乎在 RStudio 中 Rmd 文档的 markdown 临时输出的生产中引入了重大变化。

假设 RStudio 仍然使用 knitrRmd 生成 md,然后生成 html,表达式形式为:

---
output:
  html_document:
    keep_md: yes
---
```{r myimg, fig.cap="My caption"}
library(ggplot2)
qplot(Sepal.Length, Petal.Length, data = iris, color = Species)
```

用于呈现以下形式的内容:

![My caption](myimg.png)

现在在 markdown 中呈现 为:

<div class="figure">
<img src="myimg.png" alt="My caption"  />
<p class="caption">My caption</p>
</div>

这根本不是我想要的。

如何恢复原来的、更简单的 md 格式?

This issue has been fixed in knitr (>= 1.12.6) currently on Github。我正在编写图像的 HTML 代码以支持我正在处理的另一个包,我应该只在有条件的情况下启用它。现在您应该能够在 Markdown 输出中看到原始的 ![]() 语法。