Code canvas
canvas.codeBlock elementCode
Code as a canvas pane: the full editor experience — syntax highlighting, line numbers, a line/column readout, error markers — with the code choreographed like everything else on a canvas. Content is written as `lines{}` chunks; cues wrap chunks to bring them in and out on the timeline, and the pane assembles whatever is visible into one document, numbering the lines actually shown. With `editable: true`, the reader’s first keystroke forks the assembled text into their own copy (kept between visits); choreography freezes until they reset.
Attributes
languageImplicit
programming-languageDefaultauto
title
stringcontinue
Allowed content
Allowed in
Examples
canvas.code{
lines{
def greet(name):
return f"Hello, {name}!"
}
}(
language: python
title: greet.py
)canvas.code{
lines{
x = 1
}
cue{
lines{
y = x + 1
}
}(
in: 1
)
}(
language: python
)