Code windows
Window chrome on code blocks, per project and per block.
A code window draws window chrome around a code block. The options sit under extensions: mcanouil: code-window:, and three attributes override them for one block.
The Reference lists the options and their defaults.
The project settings
extensions:
mcanouil:
code-window:
style: windows
auto-filename: falseauto-filename labels a block with its language class, exactly as written. A block opened as ```{.python} is labelled python, not script.py, so the label is a language marker rather than a file name.
Turn it off where the blocks are configuration to copy rather than files to save, as this site does, because a language label only adds noise there.
wrapper names the Typst function a block is wrapped in, for a document that supplies its own.
One block at a time
Three attributes on the block itself override the project.
```{.python code-window-style="windows" code-window-no-auto-filename="true"}
print("Hello")
```code-window-stylechanges the decoration for this block.code-window-no-auto-filenamesuppresses the generated label for this block.code-window-enabled="false"leaves this block undecorated.
An attribute is read and then removed, so it does not reach the output.
Turning the chrome off entirely
extensions:
mcanouil:
code-window:
enabled: falsecode-window-enabled only switches chrome off. It cannot switch it on. When the project sets enabled: false, the filter stops before it reads any block attribute, so code-window-enabled="true" does nothing, and code-window-enabled and code-window-style are left on the block instead of being removed.
Leave enabled on and switch off the individual blocks when most blocks need chrome and a few do not.
The Typst hot-fixes
Three toggles work around Typst output problems, and each is on unless the document says otherwise.
extensions:
mcanouil:
code-window:
hotfix:
skylighting: falsecode-annotationsprocesses the annotations on a code block so they survive into Typst output.skylightingfixes the styling of a highlighted block in Typst.typst-titleevaluates a theorem title as Typst markup rather than as plain text.
Switch one off when a document supplies its own handling of the same thing, and leave the rest on. A toggle accepts an object as well as a boolean, for a fix that carries its own settings.