You Got Quarto in My Obsidian!

You Got Obsidian in My Quarto!

I was curious about creating and editing Quarto documents inside Obsidian. Turns out not only can you do that but references work, too.
news
quarto
website
Author

Ryan Straight

Published

Saturday, October 29, 2022

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.

TfTHacker/obsidian42-brat: BRAT - Beta Reviewer’s Auto-update Tool for Obsidian. Part of the Obsidian42 family of plugins.

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.

danieltomasz/qmd-as-md-obsidian: A plugin for Obsidian which allows editing of `qmd` files as if they were markdown. QMD files contain a combination of markdown and executable code cell and are a format supported by Quarto open source publishing system.

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.

Screenshot of an Rproj folder in an Obsidian vault

Rproj in Obsidian

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

  1. It just works.
  2. Differences in Obsidian are seen immediately in RStudio and vice versa.
  3. 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.

A screenshot of RStudio with a citation in-text.

Adding a citation in RStudio...

A screenshot of Obsidian recognizing a BibTeX citation key.

...means Obsidian recognizes it, as well.

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

BibTeX citation:
@misc{straight2022,
  author = {Ryan Straight},
  title = {You {Got} {Quarto} in {My} {Obsidian!}},
  date = {2022-10-29},
  url = {https://ryanstraight.com/posts/quarto-in-obsidian},
  langid = {en}
}
For attribution, please cite this work as:
Ryan Straight. (2022, October 29). You Got Quarto in My Obsidian! https://ryanstraight.com/posts/quarto-in-obsidian