From e7efdfdc7cb00ad55b37d582699a0c3b8aafe379 Mon Sep 17 00:00:00 2001 From: Phil Ewels Date: Wed, 18 Nov 2026 09:13:52 +0100 Subject: [PATCH 1/3] runnable: `runnable.args`, `sys.argv` from the title, a quiet `sys.exit()` and `COLUMNS` from the panel width A Click or Typer command in a block now runs with the code of a real file, with no `standalone_mode=False` or `prog_name`. Co-Authored-By: Claude Opus 5.5 --- .agents/DECISIONS.md | 1 + docs/e2e/runnable.test.ts | 30 ++++++++---- .../src/content/docs/extend/add-a-runtime.mdx | 7 ++- docs/src/content/docs/features/run-code.mdx | 37 +++++++++++++++ packages/starlight-codeblocks/CHANGELOG.md | 3 ++ .../src/client/runnable.ts | 20 +++++++- .../src/expressive-code/runnable.ts | 11 +++++ packages/starlight-codeblocks/src/options.ts | 11 ++++- .../starlight-codeblocks/src/reference.ts | 12 +++++ .../src/runtimes/pyodide.ts | 46 ++++++++++++++----- .../test/runnable.test.ts | 19 ++++++++ .../references/copy-and-run.md | 2 + 12 files changed, 173 insertions(+), 26 deletions(-) diff --git a/.agents/DECISIONS.md b/.agents/DECISIONS.md index f6101b4..ca54883 100644 --- a/.agents/DECISIONS.md +++ b/.agents/DECISIONS.md @@ -114,6 +114,7 @@ The choices that the code does not explain, with the options that were rejected. - **Marks on lines of output come from line states**: `[!code highlight]` and the state directives mark the line in the output panel with `decorateLine()`, the code that marks lines of code, so the classes, the screen reader name and the labels are the same. The build puts each marked line in a `hidden` element in the figure, and the client clones it when the line prints. A highlight uses Expressive Code's mark colours through `scb-state-mark`. The output colours meet 4.5:1 only on the code background, so a marked line takes the text colour of its label, which meets 4.5:1 on the tint. With line states off, the state directives are unknown, as on code lines, and `[!code highlight]` on an output line warns. *Rejected:* the output colours corrected for each tint (a new setting for each state and stream); `.ec-line` elements in the panel for Expressive Code's per-theme colours (client modules and components find code lines by that class); HTML strings in a data attribute (needs `innerHTML`); a `