I do virtually everything in either RStudio and Obsidian. It occurred to me that I should try to integrate the two to alleviate the need to sync manually between Obsidian notes and Quarto documents. I also occasionally want to export a file and the Obsidian export (especially to PDF) is a bit hit-or-miss. Quarto (and Rmarkdown, for that matter) templates are much more configurable and customizable.
This brief step-by-step assumes you 1) use Obsidian (and, if you don’t, why not?), 2) use Quarto, and 3) are comfortable installing beta Obsidian plugins that have not been added to the community plugin list.
Step 1: Install qmd-as-md
plugin
This, of course, requires you to also install and enable BRAT.
Then, use the BRAT: Plugins: Add a beta plugin for testing
command in Obsidian. This just requires you to add the username/repo
of a plugin, so in this case, danieltomasz/qmd-as-md-obsidian
.
Step 2: Create your Rproj
After you’ve got everything up and running, it’s really as simple as creating the new project inside an Obsidian vault, either by creating a new folder in Obsidian first and using “Existing folder” in RStudio, or choosing “New folder” in RStudio and placing that in Obsidian where you want it.
As you can see, the word counts don’t show up (they’re not .md
files, after all) and, to my knowledge, there’s no way to hide specific filetypes inside Obsidian without tweaking the CSS, which I haven’t bothered to do.
Step 3: Enjoy!
Yup, that’s really all there is to it. I do have some thoughts, though, as this is more of a novelty than a solution to anything in particular.
The Good
- It just works.
- Differences in Obsidian are seen immediately in RStudio and vice versa.
- Adding citations in RStudio with the Quarto
/citation
command, which creates a.bib
file, means Obsidian recognizes it as a citation, as well. The screenshots below demonstrate this. I’m also using this plugin to get the reference list in a sidebar: mgmeyers/obsidian-pandoc-reference-list: Display a formatted reference in Obsidian’s sidebar for each pandoc citekey in the active document.
Less than good
- All files now live in Obsidian, even .aux, .log, etc, when rendering to PDF, so these should be ignored in your syncing process.
- Makes more granular versioning more difficult, like one would with separate Git repositories for different Quarto projects, so best to keep for content you don’t need to have cordoned off.
- Linting that adds YAML fields on save creates issues with Qmd YAML, but if you disconnect linting from saving, you’re good to go. Worst thing to happen is the need to remove those YAML fields in the Qmd before rendering.
So, what will I use this for? Likely just documents that I don’t ever need to publish or disseminate beyond rendering. Lecture notes, letters of support/recommendation, that sort of thing. I’m really just now playing around with this and I’m sure there are other use-cases and processes that make sense, as well. Still, it certainly is pretty handy for us Quarto-minded folks.
Reuse
Citation
@misc{straight2022,
author = {Straight, Ryan},
title = {You {Got} {Quarto} in {My} {Obsidian!}},
date = {2022-10-29},
url = {https://ryanstraight.com/posts/quarto-in-obsidian/},
langid = {en}
}