Body & content attributes
The { } body and the content attributes written in braces: which constructs declare them, what each accepts, what a scene keeps to its body or its canvas, and inline content in attributes.
On this page
#The { } body and content attributes
A construct holds content in its { } body, written straight after its head. A construct that holds a second block of content declares a content attribute: an attribute in the ( ) group whose value is written in braces, name: { … }, and holds constructs as a body does. The value may span lines, and the braces are required. Five constructs declare one or more:
scene— the body is the narrative,canvas:the canvas.task— the body sets the exercise;hint:andsolution:each hold a fold, collapsed until revealed, the hint first.theorem— the body is the statement,proof:the proof, collapsed until revealed.question— the body is the prompt,feedback:the feedback shown when the question closes.option— the body is the answer offered,feedback:the feedback shown when it was picked.
scene{
The narrative.
}(
canvas: {
graph{
curve(expression: x^2)
}
}
)Written without braces, the value is refused: `canvas` takes block content, written in braces — `canvas: { … }`.
#What each accepts
A body accepts one of four kinds of content, and every reference page states which under Allowed content:
- Constructs, from a list. Anything else written there is an error. A
graphbody takes marks, cues and controls, and no prose. - Inline text: prose with micronodes, such as a
box's label or a!link's words. - Literal text, kept as written: the code in
lines, the TeX inequation. Micronodes, delimiters and//comments are not read there. - Nothing. Marks take no body; a mark's words are its
label:attribute.
A content attribute accepts constructs only, from a list of its own, and refuses anything else as a body does.
A sentence written in a graph body is refused: node `paragraph` is not allowed in `graph` when `plane: xy`.
The same list read the other way round is printed on every node's page under Allowed in: the constructs that accept it.
#A scene's body and canvas
A scene's body and its canvas: share some constructs and keep others to one side:
- Either: paragraphs, the four headings,
listandequation. - The body only: the callouts
definition,example,note,panel,task,theoremandwarning, theinternotereference,dividerandstep. canvas:only: the environmentsgraph,code,region,flowchart,logicandnetwork, and thegridthat lays them out;table,imageandquestion; the controlssliderandselector; and the cues.
Four micronodes are refused in the body, wherever in it they are written: the text colours, !highlight with its ==…== spelling, !symbol and !cue.highlight. Bold, italic, code and maths are read in both. The colour goes on the canvas, in canvas::
scene{
The teal curve is the faster decay.
}(
canvas: {
The !teal{teal} curve is the faster decay.
graph{
curve(f: e^(-2x); colour: teal)
curve(f: e^(-x))
}
}
)Written in the body, it is refused:
scene{
The !teal{teal} curve is the faster decay.
}[semantic]'!teal' is not allowed in the narrative; colour, highlighting and symbols belong in the canvas
#Inline content in an attribute
An attribute of type rich-text takes inline text, read as a paragraph's is: formatting, $maths$, micronodes and {{…}} expressions. It is written without braces. Every mark's label: is rich text, as are a graph's axis labels, a control's name:, a callout's title:, a definition's term: and an image's caption:. The type column of each reference page says which attributes are.


graph{
curve#h(expression: 20x - 5x^2; label: $h = 20t - 5t^2$)
point(x: 2; y: 20; label: !teal{highest point})
text(x: 2; y: 8; label: peak **{{round(#h.max, 1)}} m**)
}(
x domain: [0, 4]
y domain: [0, 25]
x axis label: $t$ (s)
y axis label: $h$ (m)
)A rich-text value holds inline content only. Where a canvas needs a paragraph, a list or an equation, the scene's canvas: takes one directly.