Skip to content

Commit

Permalink
🧮 Require location on node source to enable jupyter computation (#381)
Browse files Browse the repository at this point in the history
  • Loading branch information
fwkoch authored May 9, 2024
1 parent 0cea444 commit 21f72bd
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/giant-bugs-rest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@myst-theme/jupyter': patch
---

Require location on node source to enable jupyter computation
7 changes: 6 additions & 1 deletion packages/jupyter/src/decoration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,25 @@ export function OutputDecoration({
children,
title = 'Jupyter Notebook',
url,
location,
}: {
outputId: string;
placeholder?: GenericNode;
children?: React.ReactNode;
title?: string;
url?: string;
location?: string;
}) {
const { kind } = useCellExecution(outputId);
const compute = useComputeOptions();
const Link = useLinkProvider();
const top = useThemeTop();
const baseurl = useBaseurl();
const showComputeControls =
compute?.enabled && compute?.features.figureCompute && kind === SourceFileKind.Article;
compute?.enabled &&
compute?.features.figureCompute &&
kind === SourceFileKind.Article &&
location;

if (showComputeControls) {
return (
Expand Down
1 change: 1 addition & 0 deletions packages/jupyter/src/embed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export function Embed({ node }: { node: GenericNode }) {
outputId={output.id}
title={node.source?.title}
url={node.source?.url}
location={node.source?.location}
>
<MyST ast={node.children} />
</OutputDecoration>
Expand Down
1 change: 1 addition & 0 deletions packages/jupyter/src/figure.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export function Figure({ node }: { node: GenericNode }) {
placeholder={placeholder}
title={node.source?.title}
url={node.source?.url}
location={node.source?.location}
>
<MyST ast={others} />
</OutputDecoration>
Expand Down

0 comments on commit 21f72bd

Please sign in to comment.