Site icon R-bloggers

Missing in Plots in Blogdown-Posts when using .Rmarkdown instead of .Rmd

[This article was first published on rstats-tips.net, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Lately I’ve had the problem that ggplot2-plots were missing in my blogdown-posts.

I discovered that this problem only occurs when I used .Rmarkdown instead of .Rmd.

Going back to .Rmd was no option because I want to use syntax highlighting for the embedded R-code (see my article).

After some googling I found https://discourse.gohugo.io/t/raw-html-getting-omitted-in-0-60-0/22032 with the solution to add

1
2
[markup.goldmark.renderer]
  unsafe= true

in the file config.toml.

So far, so good.

Now I’ve updated several packages, including blogdown – and guess what, the plots were gone again.

This time I read the release notes and found the solution.

Blogdown create for each new article a new directory by default. Therefor I had “Consequently, not ignore “_files$” in the ignoreFiles field in your config.toml or config.yaml any more.”

I also found a great article by Alison Hill.

It describes some functions to check your blogdown installation, such as:

Good to know!

To leave a comment for the author, please follow the link and comment on their blog: rstats-tips.net.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.