show quarto-code example in quarto document with inline code

I want to include a quarto code chunk in a quarto document that contains inline code. According to the documentation, it should work like this https://quarto.org/docs/output-formats/html-code.html:

````
---
title: "My document"
---
Some markdown content.
```{{python}}
1 + 1
```
Some additional markdown content.
````

which works. However, if "Some markdown content" contains some inline code, it is always executed:

````
---
title: "My document"
---
Some markdown content `r today()`.
```{{python}}
1 + 1
```
Some additional markdown content.
````

How can I prvent the r today()being executed inside the

 ````
some Markdown `r today()`
````

Thanks

This works for me (where the zero-width space with code 8203 is documented in
https://en.wikipedia.org/wiki/Zero-width_space ).
But maybe it can be done in an easier way.

qmd-file

---
title: "Untitled"
format: html
---

The date `r lubridate::today()` is produced by \`​r lubridate::today()\` 

```{{r}}
1 + 1
```
Some additional markdown content.

produces
image

You need to use some knitr tricks as inline R code will be evaluated by knitr no matter the markdown syntax around (code chunk) - it is not aware of it. Quarto alone won't be able to prevent evaluation by knitr of the inline code.

See the recent verbatim engine that was created for that purpose.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.