lines
A chunk of literal code lines inside a canvas.code environment — the unit cues wrap and the unit everything else addresses. Chunks rather than line numbers, because choreography shifts line numbers: the moment a cue inserts three lines, every number below it points at the wrong line. Common indentation is stripped, so the chalk source can be indented normally.
Writing with it:Code environment execution model
#Attributes
Also written: indent-levelIndentation levels (four spaces each) restored on assembly — the compiler dedents every literal body to its own margin, so a chunk continuing a block states its depth.Can be written as shorthand: lines:value
Default
0The continuous highlight: these lines carry a wash for as long as they are shown. For a momentary one, wrap the chunk in a
cue.highlight.Default
falseAlso written: error-line, errorsLines to flag with the gutter’s error marker — 1-based within THIS chunk.
Also written: diagnostic, error-noteThe diagnostic the interpreter would give — rendered inline at the end of the chunk's first error line, the way an IDE annotates a broken line.
Also written: added-line, addedDiff wash: these lines carry the green added treatment — 1-based within THIS chunk.
Also written: removed-line, removedDiff wash: these lines carry the red removed treatment — 1-based within THIS chunk.
The chunk never displays and always executes — prepended to a run in source order, outside cue gating and hidden.
Default
false#Allowed content
Body { }Literal code lines, kept verbatim.
#Allowed in
#Examples
lines{
def f(x):
return x * 2
}lines{
return x * 2
}(
highlight: true
)lines{
def f(x):
return undefined_name
}(
error-lines: 2
error-message: NameError: name 'undefined_name' is not defined
)lines{
return total / len(values)
}(
indent: 1
added-lines: 1
)