Code
print("This is a computed code block. The code block will be executed.")
This is a computed code block. The code block will be executed.
Joost Gevaert
August 18, 2024
August 22, 2023
Quarto makes it really easy to set up a smoothly working and beautiful website. It took me less than 3 days to set up Bedrock’s website with:
custom Home landing page,
a methodology for efficiently creating feature-rich Documentation,
“blog” under Articles,
Community page,
Help ▼ menu,
About page,
and GitHub links to:
Quarto makes it easy to implement many features that are essential for modern (docs) websites, see below 🤩. Building all these features from without handy tooling is, … daunting.
Other tools I looked at:
Nice intro, but … Quarto?
Markdown is an easy to read and write text format:
Use LaTeX to write equations: \[ x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} \tag{1}\]
Quarto’s docs list some pretty awesome lists that I wasn’t aware of, and creative ways of using them. My highlight, definitions:
Footnotes in a Quarto website get a hover preview 🤩1
A somewhat cryptic way of saying that you can use this to to say that this is how you can embed other websites . For example:
```{=html}
<iframe title="Kai Tak - Speckle" src="https://app.speckle.systems/projects/013aaf06e7/models/0fa0287ba8,a739490298,c59c767566#embed=%7B%22isEnabled%22%3Atrue%7D" width="100%" height="500" frameborder="0"></iframe>
```
embeds ⬇️
A Quarto Website project produces HTML documents (see _site
directory) as output from the Quarto (.qmd
), Markdown (.md
), or Jupyter Notebook (.ipynb
) files, which are then put together into a website with all the features a modern (docs) site needs by Quarto. Code blocks in these HTML documents comes in 2 types:
Static Code. Static code is not executed by Quarto when the website is generated, and can therefore not produce output such as figures. Static code blocks can be generated like this:
Result 👇
Computed Code. Computed code is executed by Quarto when the website it generated, and can therefore produce output such as figures. These figures can also be made interactive when you use a library such as plotly
. Computed code blocks can be generated like this:
Result 👇
This is a computed code block. The code block will be executed.
As you can see, this is a bit tricky, because the difference between a code block being static ({.python}
) and computed ({python}
) is only a single “.”.
Below a little more exciting example of a computed Python code block. Figure 1 actually comes from Quarto’s Get Started Guide.
Quarto also has beatiful code annotations:
So, Markdown provides a great developer i.e. contributor experience, and the Code & Interactivity features make Quarto documentation useful and engaging, but that doesn’t give you a good website yet. Therefore, this section highlights some of the awesome Quarto features that are essential for modern (docs) websites.
_quarto.yml
on GitHub.When editing the search appearance when using a search textbox
, the “Search” placeholder is not showing up in the website.
The way that cross-referencing is implemented in Quarto is very slick as well:
Several other Quarto features that I like and (might) want to make use of in the future:
notebook-view
).quartodoc
is a Python package for generating API reference documentation of a Python package with proper docstrings
that is based on, and integrates with Quarto.Hey, that tickles 🤣↩︎