Skip to content

Commit

Permalink
🧮 Look to remoteBaseUrl instead of location for disabling jupyter com…
Browse files Browse the repository at this point in the history
…putation (#382)
  • Loading branch information
fwkoch authored May 10, 2024
1 parent d1d2b7f commit d2897c9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .changeset/giant-bugs-rest.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
'@myst-theme/jupyter': patch
---

Require location on node source to enable jupyter computation
Disable jupyter computation on nodes if remoteBaseUrl is present
10 changes: 5 additions & 5 deletions packages/jupyter/src/decoration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ export function OutputDecoration({
children,
title = 'Jupyter Notebook',
url,
location,
remoteBaseUrl,
}: {
outputId: string;
placeholder?: GenericNode;
children?: React.ReactNode;
title?: string;
url?: string;
location?: string;
remoteBaseUrl?: string;
}) {
const { kind } = useCellExecution(outputId);
const compute = useComputeOptions();
Expand All @@ -50,7 +50,7 @@ export function OutputDecoration({
compute?.enabled &&
compute?.features.figureCompute &&
kind === SourceFileKind.Article &&
location;
!remoteBaseUrl;

if (showComputeControls) {
return (
Expand All @@ -65,7 +65,7 @@ export function OutputDecoration({
<span className="ml-2">Source:</span>
{url && (
<Link
to={withBaseurl(url, baseurl)}
to={withBaseurl(url, remoteBaseUrl ?? baseurl)}
className="ml-2 no-underline text-normal hover:underline"
>
{title}
Expand All @@ -92,7 +92,7 @@ export function OutputDecoration({
<div className="ml-1">Source:</div>
{url && (
<Link
to={withBaseurl(url, baseurl)}
to={withBaseurl(url, remoteBaseUrl ?? baseurl)}
className="ml-1 no-underline text-normal hover:underline"
>
{title}
Expand Down
2 changes: 1 addition & 1 deletion packages/jupyter/src/embed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function Embed({ node }: { node: GenericNode }) {
outputId={output.id}
title={node.source?.title}
url={node.source?.url}
location={node.source?.location}
remoteBaseUrl={node.source?.remoteBaseUrl}
>
<MyST ast={node.children} />
</OutputDecoration>
Expand Down
2 changes: 1 addition & 1 deletion packages/jupyter/src/figure.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function Figure({ node }: { node: GenericNode }) {
placeholder={placeholder}
title={node.source?.title}
url={node.source?.url}
location={node.source?.location}
remoteBaseUrl={node.source?.remoteBaseUrl}
>
<MyST ast={others} />
</OutputDecoration>
Expand Down

0 comments on commit d2897c9

Please sign in to comment.