Manual
Overview
Language
IntroductionScenes & structureText & inlineGraphsCode panesAnimationDataReuse & logicExpressions & parameters
Elements
Text
ParagraphHeading 1Heading 2Heading 3Heading 4Unordered ListDivider
Media
ImageTableEquation
Callouts
NoteDefinitionExampleTask
Graph
GraphLinePolygonCurveIntegralScatterHistogramPointSegmentVectorCircleSquareRectangleTriangleStarDiamondHexagonTextAxis labelAxis BraceFitResidualsContourHeatmapParameter
Code
Code canvasLines
Animation
CueDraw cueTrace cueHighlight cueSpotlight cueType cue
Structure
SceneStep
Reference
Internote Reference
Inline
Formatting
BoldItalicsInline CodeHighlightLink
Text colour
Red textOrange textYellow textGreen textTeal textBlue textPurple textPink textGrey text
Maths
Maths
Reference
Internote ReferenceValueConstant
Other
FootnoteIcon
Directives
DatasetIncludeConstantsTemplatePresetConditionalForIgnore
Keyframes
KeyframeZoom keyframe
Attribute types
?
  1. Directives
  2. Template

Template

@defineDirective

Declares a template — a node shape written once and stamped out wherever its name is used. The implicit attribute `node` names the type being declared, written in the head (`@define:card`); the attribute group declares the template’s own parameters with their defaults, and `{{param}}` splices each parameter verbatim into the body. A template may use other templates, but circular expansion is a compile error.

Attributes

nodeRequiredImplicit
The name of the type being declared, written in the head: @define:card. It cannot also be a template parameter.The head shorthand supplies it: @define:value

Allowed content

Body { }The template — the Chalk that replaces each use, with {{param}} splices

Examples

@define:swatch{
    square(x: 0; y: 0; size: 1; colour: {{colour}})
}(
    colour: blue
)

swatch(colour: red)
On this page
AttributesExamples
Template · Internote