knit2html: embedding images with base64

372 views
Skip to first unread message

Georges Dupret

unread,
Aug 9, 2013, 8:19:50 PM8/9/13
to kn...@googlegroups.com
Hi!

It used to work out of the box within RStudio, but now the images are not embedded anymore in the output. I tried to fix it from within R:

knit2html("average.Rmd", options=c("use_xhtml","smartypants","mathjax","highlight_code", "base64_images"))

(this is inspired from http://stackoverflow.com/questions/14870589/knitr-r-how-not-to-embed-images-in-the-html-file)

but the "base64_images" option doesn't fix the problem. the md files shows, for example:

![plot of chunk boxplots all](figure/boxplots all1.png)

which is translated to
<p><img src="figure/boxplots%20all1.png" alt="plot of chunk boxplots all"/> </p>

What puzzles me the most is that in some report, some of the images are embedded and others are not.

Any idea?

Thanks for your help.

ge

Yihui Xie

unread,
Aug 9, 2013, 8:22:24 PM8/9/13
to Georges Dupret, kn...@googlegroups.com
The space in the file path is the culprit. You can either remove the
space in the chunk label, or use the latest version of the markdown
package on CRAN.

Regards,
Yihui
--
Yihui Xie <xiey...@gmail.com>
Phone: 206-667-4385 Web: http://yihui.name
Fred Hutchinson Cancer Research Center, Seattle

Georges Dupret

unread,
Aug 9, 2013, 8:32:45 PM8/9/13
to kn...@googlegroups.com, Georges Dupret
thanks! removing the spaces solves the problem. (Update of the markdown package doesn't though) best, ge
Reply all
Reply to author
Forward
0 new messages