r - Disabling code chunk highlighting in Bookdown (RMarkdown) theorem environments

Viewed 141

So I'm using RMarkdown with the Bookdown extension to take notes in math classes. Bookdown has several pre-defined math environments to include and auto-number theorems, definitions, proofs, etc.

These are implemented as special code chunks in RMarkdown; for example, this chunk with the {theorem} header renders the text as a theorem in the output

```{theorem}
Here is my theorem.
``\`

The issue I'm facing is that RMarkdown seems to be treating the text inside the body as code, and as a result, several convenient features of the RMarkdown editor do not work here. For instance, one cannot click on inline math to get a preview pop-up, and inserting a ' (like in variable names such as x') highlights the rest of the body in green (presumably because the editor thinks its the beginning of a string).

Is there a way to get the editor to treat the Bookdown math environments as regular text instead of code? Alternatively, is there a way to create special headers for math environments (like maybe # (thm) Pythagorean theorem)?

Any help will be appreciated.

0 Answers
Related