I am working on a Rmarkdown book with the package bookdown. At some point, I am using a R chunk to create some HTML code (with the option "asis" in the chunk header). In that HTML, I would like to add a reference to a chunk in an other part of the book. Note that this part is created in a separated html file by pandoc.
The function generating the HTML works well and the HTML is rendered as expected, but the references added with @ref(chunkid) are not converted to links. They are just plain text in the HTML.
I tried to add the function cat
to print the HTML code, but if I do so, the HTML is not rendered and is shown as plain text.
This is what I have currently:
```{r results = 'asis'}
"<h2>An html title</h2>
<div>\\@ref(titi22)</div>
"
```\
This will render the expected HTML when the book is knitted but the link in the div is not created. @ref(titi22) is written in the div.
On the real case, this is what I get
If I add cat:
```{r results = 'asis'}
cat("<h2>An html title</h2>
<div>\\@ref(titi22)</div>
")
```\
The HTML is not rendered nor the reference.
How can I render the reference and the HTML?
Thank you