From 617f980bf51dce2db1292efb9e0d4c72aa6d14bc Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Tue, 2 Jun 2026 18:05:37 +0200 Subject: [PATCH] playground: update URL when clicking an example --- content/playground.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/content/playground.md b/content/playground.md index 30e7f4325..9f48b426f 100644 --- a/content/playground.md +++ b/content/playground.md @@ -104,6 +104,10 @@ Click an example to run it in the terminal: document.querySelectorAll('.playground-example').forEach(function(btn) { btn.addEventListener('click', function() { var cmd = btn.textContent; + // Reflect the clicked example in the URL so it can be shared/bookmarked. + var url = new URL(window.location.href); + url.searchParams.set('cmd', cmd); + history.replaceState(null, '', url); document.getElementById('wasm-playground').scrollIntoView({ behavior: 'smooth' }); if (window.runInTerminal) { window.runInTerminal(cmd);