knitr changes (1) to <ol> when rendering html?

If you don't want to remove the format="html" argument, you could try using the HTML character entities for the parentheses (&lpar and &rpar) and then add the argument escape = FALSE:

```{r cars}
mtcars$am <- sprintf("&lpar;%s&rpar;", as.character(mtcars$am))
knitr::kable(mtcars, format = "html", escape = FALSE)
```

enter image description here

Still not entirely sure of what is causing the error though. It seems that the specific combination of parentheses is being processed strangely by knitr.


An alternative solution is to escape the parentheses, e.g.,

mtcars$am <- sprintf("\\(%s)", as.character(mtcars$am))

Then you won't need escape = FALSE.

See https://pandoc.org/MANUAL.html#backslash-escapes in Pandoc's Manual.