Manual
The document
OverviewGrammarDocument headerSyntax cheatsheet Scene Step
Content
Text blocks
Paragraph Heading 1 Heading 2 Heading 3 Heading 4 List
Maths
Equation Maths
Tables & images
Table Image
Formatting
Bold Italics Inline Code Highlight
Text colours
Links & references
Link Footnote Icon Internote Reference
ValueWhere inline content works
Narrative only
Note Definition Example Task Divider
Graph pane
Graph
Curves & areas
Curve Integral
Data marks
Scatter Histogram
Fits
Fit Residuals
Surfaces
Contour Heatmap
Marks
Line Segment Vector Point Polygon Text
Shapes
Circle Square Rectangle Triangle Star Diamond Hexagon
Axis furniture
Axis label Axis Brace
Expressions
Code pane
Code Lines
Animation & interaction
Cues that wrap content
Cue Draw cue Trace cue Highlight cue Spotlight cue Type cue
Cues on a value
Value cue Zoom cue
Anchors & timing Parameter
Advanced features
Data Let Define Preset Include If For Ignore
Reference
All constructs A–ZAttribute types
Concepts
IdentifiersBody & detailDerived attributes
Guidance
The narrative contractWhat earns a place on the canvasParameter or cueHonest numbersCode demonstrates, never computesAuthor-attached data only
?
  1. Reference
  2. Guidance
  3. Code demonstrates, never computes

Code demonstrates, never computes

A code pane shows a procedure. Its output is authored — nothing it contains produces canvas content.

#The rule

A code pane demonstrates a procedure. It never produces content. Nothing written in a canvas.code pane runs to make a plot, feed a graph, or generate data.

#What this buys

It is the line between a document medium and a compute notebook, and holding it is what keeps an internote free of kernels, environments, package versions and execution state. A reader opening a five-year-old internote sees what its author saw. A reader opening a five-year-old notebook sees whatever their environment does today, which is usually an error.

It also keeps authorship honest in the same way Honest numbers does, from the other direction: a graph is authored in Chalk and says what the author meant it to say, rather than being whatever a script happened to emit.

#Authoring the output

Where the reader should see a result, write it — as a comment, or as a later chunk that states what an interpreter would print. It is authored content, exactly like the prose, and it carries the same obligation to be true.

canvas.code{
    lines{
        z, log_c = np.polyfit(log_area, log_species, 1)
    }
    cue.type{
        lines{
            print(z)   # 0.34
        }
    }(
        in: 1
    )
}(
    language: python
)

#Keeping code and canvas in agreement

Since neither half computes the other, they agree only because you made them. Two things help. Splice shared values in with {{ }} so the code and the canvas read from one source — a @data column reaches a literal code body exactly as it reaches prose. And where a number in the code is also a number in the argument, prefer a @let constant over typing it twice.

@data#survey:galapagos-plants-1973.csv

canvas.code{
    lines{
        area = np.array([{{#survey.area}}])
    }
}(
    language: python
)
On this page
The ruleWhat this buysAuthoring the outputKeeping code and canvas in agreement
PrivacyTermsContact Support
Code demonstrates, never computes · Internote