Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Add notebook base url links to embed source #146

Merged
merged 1 commit into from
Jul 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/strong-flowers-sniff.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@myst-theme/jupyter': patch
---

Add base url to notebook source links
8 changes: 6 additions & 2 deletions packages/jupyter/src/embed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
} from './controls/ArticleCellControls';
import { JupyterIcon } from '@scienceicons/react/24/solid';
import { select } from 'unist-util-select';
import { useLinkProvider } from '@myst-theme/providers';
import { useLinkProvider, useBaseurl, withBaseurl } from '@myst-theme/providers';

function EmbedWithControls({
outputKey,
Expand All @@ -22,6 +22,7 @@ function EmbedWithControls({
}) {
const { kind } = useCellExecution(outputKey);
const Link = useLinkProvider();
const baseurl = useBaseurl();
const showControls = kind === SourceFileKind.Article;

return (
Expand All @@ -33,7 +34,10 @@ function EmbedWithControls({
<JupyterIcon className="inline-block w-5 h-5" />
<span className="ml-2">Source:</span>
{url && (
<Link to={url} className="ml-2 no-underline text-normal hover:underline">
<Link
to={withBaseurl(url, baseurl)}
className="ml-2 no-underline text-normal hover:underline"
>
{title}
</Link>
)}
Expand Down