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

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.

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

Comments

Your Answer

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.