Skip to content

Standardize all playground pages on the interactive runtime - #247

Merged
mrjf merged 2 commits into
mainfrom
copilot/fix-playground-issues
Apr 30, 2026
Merged

Standardize all playground pages on the interactive runtime#247
mrjf merged 2 commits into
mainfrom
copilot/fix-playground-issues

Conversation

Copilot AI commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Of 130 pages under playground/, only 31 used the working interactive template. The other 99 were broken in two distinct ways: 79 referenced a non-existent style.css/runtime.js (no styles → "single-row" layout, no execution), and 20 loaded playground-runtime.js but never created any .playground-block markup (light theme, non-interactive).

Changes

  • tests/playground.test.ts — new conformance suite asserting every playground/*.html (except the landing page) loads playground-runtime.js, has a #playground-loading overlay, contains .playground-block / .playground-editor / .playground-run / .playground-output, uses the dark-theme CSS variables, and does not reference the legacy missing style.css or ./runtime.js.
  • 98 playground pages converted to the standard template. A one-shot conversion extracted existing snippets from <pre>, <pre><code>, <div class="code-block">, and <textarea> containers and re-emitted each page with the canonical dark-theme styles, loading overlay, per-snippet .playground-block editors, and the shared <script type="module" src="playground-runtime.js">.
  • Legacy code rewrites applied during conversion so snippets execute under the standard runtime (which only exposes tsb via import { … } from "tsb"):
    • const { X, Y } = tsb;import { X, Y } from "tsb"; (anchored so destructuring like const { codes } = tsb.factorize(...) is left for the next rule)
    • tsb.foo(...) → collect referenced names, prepend a single import { foo, … } from "tsb";, strip the tsb. prefix
  • Fallback for pages with no extractable snippets (UI-builder pages such as date_range.html, timestamp.html, benchmarks.html): seed a starter .playground-block with imports/constructors discovered in the page's own scripts, keeping the page interactive.

The conformance test now covers all 130 pages with 1162 assertions; running it with the previous content surfaced 666 failures across the broken pages, which is the regression guard going forward.

Copilot AI changed the title [WIP] Fix playgrounds formatting and add tests for functionality Standardize all playground pages on the interactive runtime Apr 29, 2026
Copilot AI requested a review from mrjf April 29, 2026 23:50
Copilot finished work on behalf of mrjf April 29, 2026 23:50
@mrjf
mrjf marked this pull request as ready for review April 30, 2026 05:35
@mrjf
mrjf merged commit 5f25d76 into main Apr 30, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Many playgrounds on the pages doc site don't work, have bad fromatting

2 participants