Accessible tools that allow you to customize and extend Quarto.
Parlance Labs
We will cover the last two.
See the docs
#|hide
to hide cellsRead from stdin
and write to stdout
.
The filter
filter.py
import sys
import nbformat
# read notebook from stdin
nb = nbformat.reads(sys.stdin.read(), as_version = 4)
# prepend a comment to the source of each cell
for index, cell in enumerate(nb.cells):
if cell.cell_type == 'code':
if "#|hide" in cell.source:
# delete cell
del nb.cells[index]
# write notebook to stdout
nbformat.write(nb, sys.stdout)
The project config:
From this repo:
Does the notebook look like you expect? Prototype on a minimal notebook first!
Save the notebook:
Open the notebook in JupyterLab or VSCode.
Let me show you live!
Set breakpoints
It is useful to put breakpoints in your filter script to learn the nbformat
API.
Let’s see how other people are using them. I found this.
These are not like notebook filters, but they are a way to run arbitrary code before a project is rendered.
See this documentation.
I don’t use these personally! But let’s see what other people are doing.
This example is interesting.
Resources: