Block syntax reference

readrun extends Markdown with [name]...[/name] blocks for executable code, file references, quizzes, and other interactive elements. Blocks are parsed at build time and rendered as HTML.

Open/close blocks

Containers with an opener [name] and closer [/name]. Content between them is rendered according to the block type. Block names are explicit in the closer so nesting is unambiguous.

code
[python]
print("hello")
[/python]

Self-closing blocks

Short form [name=path] or [name key=value] that does not need a closer.

code
[upload label="Upload CSV" accept=.csv]
[include=partials/intro.md]
[stl=files/bracket.stl]

Universal attributes

Any block can add these:

table
2 cols · 2 rows
col width
28ch
AttributeEffect
hiddenStart collapsed. Reader clicks Show to reveal.
editableMake the code block a live scratchpad (Python/JSX only).

Block reference

Python ([python])

Renders a runnable code block. Click Run to execute in the browser via Pyodide. Output appears below the block. Python state persists across blocks on the same page (like Jupyter cells).

For Python basics, imports, and package behavior, see Code.

md
[python]
import pandas as pd
df = pd.read_csv("data.csv")
print(df.head())
[/python]

External file reference (canonical file lives in .readrun/assets/scripts/; legacy .readrun/scripts/ is also supported):

md
[python=scripts/plot.py]

JSX / React ([jsx])

Renders a React component. Auto-renders on page load — no Run button. Call render() with your root element. Full Tailwind and @readrun/widgets available.

md
[jsx]
function Counter() {
  const [n, setN] = React.useState(0);
  return <button onClick={() => setN(n+1)}>Clicked {n}</button>;
}
render(<Counter />);
[/jsx]

External file reference:

md
[jsx=scripts/chart.jsx]

Quiz ([quiz])

Interactive quiz system. Contains [question], [group], and [info] sub-blocks.

md
[quiz]

[question type=single]
What is the capital of France?
- London
- Paris *
- Berlin
[/question]

[question type=multi]
Which of these are prime numbers?
- 2 *
- 3 *
- 4
- 5 *
[/question]

[question type=truefalse]
The earth orbits the sun.
true *
[/question]

[question type=freetext]
What is 2 + 2?
= 4
[/question]

[/quiz]

Question types:

table
3 cols · 4 rows
col width
28ch
TypeCorrect answer syntaxMatching
single- Answer *Exactly one correct option
multi- Answer *One or more correct options
truefalsetrue * or false *Boolean
freetext= answerText or numeric match

Sub-blocks:

  • [hint]...[/hint] — shown before answering
  • [explain]...[/explain] — shown after answering
  • [group]...[/group] — wraps related questions under shared context
  • [info]...[/info] — reading-only content block

File upload ([upload])

Self-closing. Renders a file upload button that writes files into Pyodide’s virtual filesystem for use by subsequent Python blocks.

md
[upload label="Upload CSV" accept=.csv rename=data.csv]
[upload label="Submit files" accept=.pdf multiple]
table
3 cols · 4 rows
col width
28ch
AttributeDefaultNotes
label“Upload”Button text
acceptFile picker filter, e.g. .csv,.pdf
renameSave under this fixed name
multiplefalseAllow selecting multiple files

Include / Transclusion ([include])

Self-closing. Embeds another markdown file inline at build time.

md
[include=partials/intro.md]
[include=notes/topic.md#derivation]

Query ([query])

Self-closing. Renders a list of pages matching a frontmatter filter.

md
[query tag=python]
[query folder=notes/math sort=updated limit=10]

Raw / Verbatim ([raw])

Displays block syntax literally without executing it. Useful for documenting block syntax itself.

md
[raw]
[jsx]
<Chart />
[/jsx]
[/raw]

Image ([image])

Self-closing image reference block. Images live anywhere under .readrun/assets/.

md
[image=images/diagram.svg]

Images are embedded into the rendered page and open in the lightbox when clicked.

Viewer blocks

Self-closing file reference blocks. Files live anywhere under .readrun/assets/.

table
3 cols · 6 rows
col width
28ch
BlockFile typesDescription
[stl=models/file.stl].stl3D mesh viewer (Three.js, lazy-loaded)
[model=models/file.glb].glb, .gltf3D scene viewer (Three.js, lazy-loaded)
[csv=data/file.csv].csvInteractive table with sort, filter, pagination
[pdf=docs/file.pdf].pdfEmbedded PDF viewer
[audio=media/file.mp3].mp3, .wav, .ogg, .m4aAudio player
[video=media/file.mp4].mp4, .webm, .ogvVideo player

Common attributes: height (pixels, for stl/model), loop (audio/video), muted (video).

Three.js (~600KB) loads only on pages that contain [stl=] or [model=] blocks.

Escape

Prefix a block opener with \\ to render it literally:

code
\\[jsx] renders as [jsx]

Block syntax inside backtick code fences or inline code is never parsed.