Hi, all,
I've been using R Markdown for a while, in order to gain a "competitive advantage" when writing posts for the company blog, because instead of having to use the blog interface, I can just write the blog post in RStudio, compile to HTML with the option of keeping the Markdown file and then load the Markdown file to the company blog, and voilà, here's my blog post!
However, lately the Markdown file produced by pandoc
doesn't seem to be compatible with the company blog platform anymore. This may be due to changes in the platform, of course, but actually even the preview of Visual Studio Code doesn't render them correctly, so I'm wondering if something has changed on the R side of things...here is the original R Markdown file:
---
title: "test"
subtitle: "test"
author: "test"
date: "test"
output:
html_document:
keep_md: true
fig_caption: yes
---
<style>
p.caption {
font-size: 0.8em;
}
</style>
```{r setup, include=FALSE}
library(knitr)
library(pander)
opts_chunk$set(echo = FALSE,
out.width = "75%",
fig.align = "center")
```
## Table
```{r table}
methods <- data.frame(kernel = c("RBF", "RBF", "Matern 5/2"),
ARD = c("No", "Yes", "No"),
RMSE = c(1.46, 1.34, 1.27))
pander(methods)
```
Here is the HTML output, after knitting to HTML: it looks great!
The Markdown file generated by RStudio (I guess, by
pandoc
actually) is
---
title: "test"
subtitle: "test"
author: "test"
date: "test"
output:
html_document:
keep_md: true
fig_caption: yes
---
<style>
p.caption {
font-size: 0.8em;
}
</style>
## Table
-------------------------
kernel ARD RMSE
------------ ----- ------
RBF No 1.46
RBF Yes 1.34
Matern 5/2 No 1.27
-------------------------
If I now preview this file in RStudio, it looks the same as the R Markdown file HTML output:
However, previews with other tools (Visual Studio Code and my company's blog platform, in particular) look horribly mangled:
What's happening? How can I go back to my happy days, when I could just write the blog post in RStudio and then publish the corresponding Markdown file? Less dramatically, how can I fix the Markdown code so that the table doesn't look like crap?