Search code examples
rrstudiocode-snippetsquartoposit

How can I use predefined code snippets outside of code chunks in Quarto within RStudio/Posit?


I'm working on a Quarto document in RStudio/Posit where I frequently need to insert recurring formatting code. I've set up some custom code snippets in RStudio that work perfectly inside code chunks. For example, when I trigger the snippet inside a chunk (see screenshot 1), it expands as expected.

However, when I try to trigger the same snippet outside of a code chunk—in regular markdown text—it does not expand (see screenshot 2).

My question is: Is it possible to use predefined code snippets outside of code chunks in Quarto? In other words, can these snippets be triggered in plain markdown sections, or are they limited to code chunks only?

Any guidance or workarounds would be appreciated.

Screenshot 1:

enter image description here

Screenshot 2:

enter image description here


Solution

  • Try using shift + tab instead of only tab :)

    Unfortunately this doesn't show a dropdown menu but it will work when the typed characters already defines a snippet uniquely.

    For example ! + shift + tab will not do anything but ![ + shift + tab will expand to the integrated ![label](location) snippet.