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.
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.
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.
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.
Now you can insert your first cell in Julia or any other language. Press CRTL+SHIFT+I
or write the following block
=1
a+2 a
You can run the cell pressing Run Cell or Render the document and a rendered html will appear on the left!
If you have the plotting libraries installed in Julia, you can also do some plots!
using Plots
plot(sin,0,2π)