我对这个很棒的库(和 HTML)有点陌生,所以这可能是一个菜鸟问题。
我有一种情况无法弄清楚 - 如何向图像添加一些 CSS 样式,同时还使用 base64 对其进行编码?这是我的 Rmarkdown 文件中的代码(我将其传递给 knit2html
)-
<img src="SomeImage.png", width = "75%", border = "2"> # converts to base64 with width and border correctly applied
<img class="displayed", src="SomeImage.png"> # does not convert to base64, points to local path with style correctly applied
有没有办法让第二个在应用样式的同时转换为 base64?还是我做错了什么?
SessionInfo
,如果需要 -
> sessionInfo()
R version 3.0.2 (2013-09-25)
Platform: x86_64-w64-mingw32/x64 (64-bit)
other attached packages:
[1] markdown_0.6.5 xtable_1.7-1 knitr_1.5 audio_0.1-4 ggplot2_0.9.3.1
[6] scales_0.2.3 stringr_0.6.2 reshape2_1.2.2 reshape_0.8.4 plyr_1.8
[11] data.table_1.9.2
谢谢!
最佳答案
试试这个:
<style>
.displayed { border: solid 1px; }
</style>
<img src="Rplot001.png" class="displayed">
关于html - Knitr,转换为base64和CSS样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23065755/