Quarto Pipeline for VSCode

Quarto
VScode
R
Julia
Published

November 22, 2022

There are many ways to produce a code that include a narrative on what is done. I am biased towards the RStudio/Posit pipeline but, since new users may want to learn the VSCode version instead, I have tried to learn it as well.

Quarto Logo

To use Quarto, you simply need to follow the instructions you get on the website. In order to use it in the VSCode editor, you want to install the quarto extesion for the VSCode: Either press the ‘CRTL+p’ key to enter the ‘Extension Marketplace’ or click on the icon and install the Quarto extension for VSCode.

CRTL+P: Install Quarto Extension

A quarto document like this one is a Markdown document which allow for the insertion of cells which may execute some commands and it has a *.qmd extension. There are many different ways to do this, also some pure julia packages like Literate.jl and others.

If just markdown is to be used, you can already Render the document to produce one of the many outputs (html, pdf, docx…). You can also use the CRTL+K shortcut.

Render to...

It is even more interesting when you want to compute something and use the computation in the narrative of your publishing. To do that, you will need a kernel or engine which does the computation, which can be through a Jypyter kernel or a Knitr engine. In my case, as I wanted to use a Julia computation, I need to update the heading of the markdown file (a yaml instructions)

---
title: "My Quarto Pipeline for Publishing"
html:
  code-fold: true
jupyter: julia-1.8
editor:
  render-on-save: true
---

Note that you have to replace the version of Julia (1.8.2 in my case) with yours (note that you have to drop the last .2). You also need to install the IJulia package for julia.

Install IJulia from REPL

Now you can insert your first cell in Julia or any other language. Press CRTL+SHIFT+I or write the following block your first block

a=1
a+2

You can run the cell pressing Run Cell or Render the document and a rendered html will appear on the left!

Side-by-sie

If you have the plotting libraries installed in Julia, you can also do some plots!

using Plots
plot(sin,0,2π)