lines
A chunk of code inside a code environment.
linesOn this page


#Attributes
indentLevels of four spaces added to every line, for a chunk that continues a block:
lines:1{…}.Also written:
indent-levelCan be written as shorthand: lines:valueDefault
0emphasisA wash over every line of the chunk, blank lines included, for as long as it is shown. A
cue.highlight around the chunk washes it once instead.Default
falseerror-linesLines that carry the gutter's error marker, counted from 1 within this chunk.
Also written:
error-line, errorserror-messageA diagnostic set at the end of the chunk's first error line, or its first line when
error-lines is unwritten.Also written:
diagnostic, error-noteadded-linesLines washed green as added, counted from 1 within this chunk.
Also written:
added-line, addedremoved-linesLines washed red as removed, counted from 1 within this chunk.
Also written:
removed-line, removedhiddenThe chunk is left out of the file. Animatable.
Default
falsesetupThe chunk is never shown and always runs: on a
runnable environment, every setup chunk is prepended to a run in source order, whatever cues and hidden say.Default
falselockHas no effect.
Also written:
lockedDefault
false#Allowed content
Body { }Literal code lines, kept verbatim.
#Allowed in
#Examples


code{
lines{
def f(x):
}
lines{
return x * 2
}(
indent: 1
emphasis: true
)
}(
language: python
)

code{
lines{
def f(x):
return undefined_name
}(
error-lines: 2
error-message: NameError: name 'undefined_name' is not defined
)
}(
language: python
)

code{
lines{
def mean(values):
total = sum(values)
}
lines{
return total / len(values)
}(
indent: 1
added-lines: 1
)
}(
language: python
)#Notes
- A chunk is the unit a cue wraps and the unit every mark addresses.
- The environment joins the chunks on show into one file, so a chunk keeps its marks when another arrives above it.
- The body is kept verbatim apart from its indentation, which is dedented to the chunk's own margin.
- A blank line at the start of the body is kept and one at the end dropped;
lines{}is one blank line.