Problems with RMarkdown HTMLWidgets

A short description of the post.

Rodney Dyer (Center for Environmental Studies)

OK, so in working on various RMarkdown stuff, I‘ve just run across a problem with it no longer rendering HTMLWidget stuff in the recent upgrade. So if you use something like mermaid or leaflet in your xaringan presentation, it will show you the raw


output instead of the actual widget. This is not an easy one to track down online because the RMarkdown & Xaringan Github sites do not address it. So I thought I would insert a thing here so I can find it next time I need it.

As it turns out, we need to set an option in the setup chunck as follows:

options(htmltools.preserve.raw = FALSE)

This will fix things until RStudio fixes the markdown problems and the world can get back to normal.


For attribution, please cite this work as

Dyer (2021, March 16). The Dyer Laboratory: Problems with RMarkdown HTMLWidgets. Retrieved from

BibTeX citation

  author = {Dyer, Rodney},
  title = {The Dyer Laboratory: Problems with RMarkdown HTMLWidgets},
  url = {},
  year = {2021}