Hello all,
I use RStudio IDE as an R Markdown editor, to write math content.
To export to PDF or html, i use the Bookdown extension, and the 'theorem environment'.
I want to use the same *.rmd files to also export my content with Reveal.js format, using the Rstudio dedicated package.
Code chunks in *.rmd:
In my *.rmd file, I have many codechunks that written like :
<myfile.rmd>
```{theorem}
this is a theorem. $x^2 \in \mathbb{R}$ ```
which are rendered fine with bookdown in PDF and html format.
How code-chunks are converted to reveal.js html:
When exporting this *.rmd file with reveal.js, the code chunk is treated as code, and the output for the above code chunk is:
<my revealjs presentation.html>
...
<pre class="theorem">
<code>this is a theorem. $x^2 \in \mathbb{R}$</code>
</pre>
that is : RStudio has rendered my code chunk as pure code, which I can't format nicely. I would like this kind of content to be formatted into my presentation with a div tag with a "theorem" class, and no code nor pre tag.
How I would like them to be converted:
Is there a solution to filter my *.rmd file so that *all code chunks that are labelled with the {theorem} tag are rendered as normal text, within a div, instead of being runned as code.
<my revealjs presentation.html>
...
<div class="theorem">
this is a theorem. <span class="math inline">\(x^2 \in \mathbb{R}\)</span>
</div>
Maybe something can be done to pre-process the *.rmd file before running knitr ?
If someone has a solution that will be very helpful
Thanks