Interpreters Demo

VERSION a9b38ce
Interpreters Demo

Every shape of the interpreter= attribute, side by side — see SPEC.md's "Runnable code fences" section (the interpreter= entry) for the full reference. The cached output beneath each runnable block below is from an actual meshfox run invocation, not typed by hand — e.g. meshfox run --canvas examples/interpreters.canvas.md python-example seed. Each block below is also flagged default, so the web UI's own node-level "▷ run" (in the title bar, next to "expand") runs it too — not just the block's own Run button inside the node body.

Python

A fenced block's lang is only ever a syntax-highlighting hint once its own interpreter= is set — this fence's lang (python) never has to be bash/sh for the block to count as runnable, unlike a plain fence with no interpreter= at all.

print("hello from python, seeded")
exit code: 0

hello from python, seeded
Command with flags

interpreter= is word-split the same way a real shebang line's own arguments would be (#!/usr/bin/env -S ...), quoting included: interpreter="python3 -u" runs python3 with -u (unbuffered stdout) in front of the block's own temp file — the command-plus-flags shape, not just a bare executable name.

print("this prints immediately, unbuffered")
exit code: 0

this prints immediately, unbuffered
Any installed interpreter

Not just Python — anything on PATH works, since interpreter= is just a command to run the fence's own body against.

console.log("hello from node " + process.version);
exit code: 0

hello from node v26.7.0
Interactive (`tty` + `interpreter`)

interpreter= works on tty blocks too — the block hands its real terminal over to interpreter directly instead of the implicit bash. Not run here — tty and cache are mutually exclusive (see SPEC.md's "Runnable code fences"), and this needs a real interactive terminal to actually use — but it's a valid, runnable block: meshfox run --canvas examples/interpreters.canvas.md tty-example repl, from an interactive shell, drops straight into a real Python REPL.

print("welcome — this is a real interactive Python REPL")
File-node counterpart

The same interpreter= mechanism, just on a file-type node instead of a fence — this is actually where it originated (see SPEC.md's "Node types"); a runnable fence's own interpreter= is the generalized, fenced-block counterpart of this.

Seed script