4

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

L Tyrone
8,37123 gold badges34 silver badges47 bronze badges
asked Mar 5, 2025 at 18:21

2 Answers 2

5
+50

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.

answered Mar 8, 2025 at 7:35
Sign up to request clarification or add additional context in comments.

1 Comment

One thing that tripped me up: in my RStudio instance, using shift + tab only worked in Source mode (i.e. not in Visual mode).
2

Expanding on what has already been said. shift + tab should do the trick for you. The Code Snippets - Rstudio User Guide mentions that markdown snippets lack tab code completion. You'll need to type the entirety of the snippet name before shift + tab will insert the snippet. In this case my_quarto_columns

answered Mar 8, 2025 at 16:43

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.