Rmd code snippets not being rendered correctly, despite Prism

I’m using Rstudio to build my Hugo website, with their blogdown package. Everything works perfectly except that code snippets that are inside an .Rmd file (which Hugo successfully builds) are not formatted correctly. You can view a sample page here

This is the only thing which isn’t being rendered correctly. If I change the file format to .Rmarkdown, I get code snippets but lose the R output. A sample page of the same thing here

There is also a problem of R syntax highlighting. The page first loads the correctly highlighted code snippet, but switches to the other one after load:


I’ve followed this guide for downloading the correct Prism.js files for R, but it still doesn’t work.

Its been three days since I’ve tried fixing this, but with no luck. Can someone help figure out what can be done? A repo of the code which is live on Netlify is here.