I'm working on a package that can inject author data in Quarto documents. I'd like to allow users to create a place holder to insert some data in a specific location in the document. I can easily modify the Quarto document using a function in an external script. However, I'd ideally prefer to insert the place holder directly from the IDE using a shortcut (similar to Ctrl + Alt + I/Cmd + Option + I to insert a code chunk in R markdown). I presume the code chunk shortcut is integrated in RStudio but is it possible to implement such snippet/shortcut in a custom package?
I'm aware of addin and rstudioapi::insertText(). It's not really what I want though because that only executes a function via a shortcut so it can't be used to insert the place holder in an R markdown document directly.
I'm asking out of curiosity, if that's doable but hard to implement, I'll simply use a normal function.
Thanks for the suggestion. Maybe I'm the one who missed something but from what I tried, I could only run the addin in a code chunk, not outside of it. Same for snippets.
You should be able to run addin in Markdown document like .qmd . This addin does work with Rmd for example
For snippets you need to add into the Markdown syntax snipper, and not the R files. Did you do that ?
Then I think it should work, but maybe without auto completion. You need to type the snippet name and then trigger the snippet insertion (check keyboard shortcut as maybe there is no shortcut assign to the completion). You can use command palette for this too.