Search code examples
rstudioblogdown

Different rendering between .Rmd and .Rmarkdown when using blogdown


I have found some strange differences in the way .Rmd files are rendered compared to .Rmarkdown. My setup: Beautiful hugo theme Blogdown 0.9 Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows >= 8 x64 (build 9200) If change the file extension between Rmd and Rmarkdown, I observe the following differences:

  1. Rmd doesn't render multi level lists properly
  2. Rmd doesn't render footnotes [^1] properly
  3. Rmarkdown doesn't render math properly
  4. Python code chunks don't have a nice little execute button in the upper right in Rmd.

Is this expected behavior? Is there something with the theme that causes this?


Solution

  • Yes the difference between .Rmd and .Rmarkdown is expected and Yihui et al. outlines it in their book (it's around the middle of the page)

    • You cannot use Markdown features only supported by Pandoc, such as fenced Divs.

    • Math expressions only work if you apply the JavaScript solution mentioned in Section B.3.

    The main thing to note is that .Rmarkdown gets converted to .markdown documents first and gets passed onto Hugo's Markdown renderer (e.g., Goldmark or Blackfriday) to generate a html while .Rmd uses Pandoc by default.