简体   繁体   中英

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

I just updated several R packages and it seems to have introduced breaking changes in the production of markdown interim output from Rmd documents in RStudio.

Assuming knitr is still used by RStudio to generate md from Rmd on the way to producing html , expressions of the form:

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

that used to render something of the form:

![My caption](myimg.png)

now get rendered in the markdown as:

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

which is not what I want at all.

How do I the original, simpler md formatting back?

This issue has been fixed in knitr (>= 1.12.6) currently on Github . I was writing out the HTML code for images to support another package that I was working on, and I should have enabled this only conditionally. Now you should be able to see the original ![]() syntax in the Markdown output.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM