Skip to content

Commit 63662af

Browse files
authored
Merge pull request #4 from kp992/fix-colab-button
[Colab button] Remove `.myst` suffix for notebooks launcher
2 parents 6d31a51 + 6e39113 commit 63662af

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

.changeset/seven-views-pull.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@curvenote/quantecon-book": patch
3+
---
4+
5+
Fix colab link for lecture repo ending with .myst

app/components/toolbar/LaunchButton.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@ function LaunchPanel() {
3131
const [privateServiceUrl, setPrivateServiceUrl] = React.useState<string | undefined>();
3232

3333
const hasGitHub = !!project?.github;
34-
const orgRepo = project?.github ? new URL(project?.github).pathname.slice(1) : undefined;
34+
// Remove the `.myst` suffix from the orgRepo URL if present.
35+
const orgRepo = project?.github
36+
? new URL(project?.github).pathname.slice(1).replace(/\.myst$/, '')
37+
: undefined;
3538
const filename = `${page?.location.split('.')[0]}.ipynb`;
3639

3740
const handleSelect = React.useCallback((value: string) => setService(value), []);

0 commit comments

Comments
 (0)