From ceb81965ca72b0ba123e19bd5e7be5a68b472fbc Mon Sep 17 00:00:00 2001 From: Angus Hollands Date: Tue, 10 Dec 2024 14:38:03 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=8C=20Fix=20location=20to=20executable?= =?UTF-8?q?=20`.md`=20files=20in=20Thebe=20(#505)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: match any file extension * chore: add changeset --- .changeset/new-students-brush.md | 5 +++++ packages/jupyter/src/execute/leaf.tsx | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 .changeset/new-students-brush.md diff --git a/.changeset/new-students-brush.md b/.changeset/new-students-brush.md new file mode 100644 index 000000000..159ceba28 --- /dev/null +++ b/.changeset/new-students-brush.md @@ -0,0 +1,5 @@ +--- +'@myst-theme/jupyter': patch +--- + +Fix path of non-ipynb files in thebe diff --git a/packages/jupyter/src/execute/leaf.tsx b/packages/jupyter/src/execute/leaf.tsx index cda437075..7340aa639 100644 --- a/packages/jupyter/src/execute/leaf.tsx +++ b/packages/jupyter/src/execute/leaf.tsx @@ -140,9 +140,10 @@ export function SessionStarter({ // in order to allow for multiple independent sessions of the same notebook let path = `/${pageSlug}-${notebookSlug}.ipynb`; console.debug('session starter path:', path); - const match = location?.match(/(.*)\/.*.ipynb$/) ?? null; + const match = location?.match(/(.*)\/.*/) ?? null; if (match) { console.debug('session starter match:', match); + // Choose an arbitrary suffix, not important path = `${match[1]}/${pageSlug}-${notebookSlug}.ipynb`; console.debug('session starter path (modified):', path); }