From 21f72bd553213183721688c5bf816ecebc8cfbfa Mon Sep 17 00:00:00 2001 From: Franklin Koch Date: Thu, 9 May 2024 10:17:15 -0600 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=AE=20Require=20location=20on=20node?= =?UTF-8?q?=20source=20to=20enable=20jupyter=20computation=20(#381)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changeset/giant-bugs-rest.md | 5 +++++ packages/jupyter/src/decoration.tsx | 7 ++++++- packages/jupyter/src/embed.tsx | 1 + packages/jupyter/src/figure.tsx | 1 + 4 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 .changeset/giant-bugs-rest.md diff --git a/.changeset/giant-bugs-rest.md b/.changeset/giant-bugs-rest.md new file mode 100644 index 000000000..f624cf7a6 --- /dev/null +++ b/.changeset/giant-bugs-rest.md @@ -0,0 +1,5 @@ +--- +'@myst-theme/jupyter': patch +--- + +Require location on node source to enable jupyter computation diff --git a/packages/jupyter/src/decoration.tsx b/packages/jupyter/src/decoration.tsx index adc310dcb..9b6765f9e 100644 --- a/packages/jupyter/src/decoration.tsx +++ b/packages/jupyter/src/decoration.tsx @@ -32,12 +32,14 @@ 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(); @@ -45,7 +47,10 @@ export function OutputDecoration({ 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 ( diff --git a/packages/jupyter/src/embed.tsx b/packages/jupyter/src/embed.tsx index 7afa10d53..e7b2006e8 100644 --- a/packages/jupyter/src/embed.tsx +++ b/packages/jupyter/src/embed.tsx @@ -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} > diff --git a/packages/jupyter/src/figure.tsx b/packages/jupyter/src/figure.tsx index 6b5299d1a..59c4f02b5 100644 --- a/packages/jupyter/src/figure.tsx +++ b/packages/jupyter/src/figure.tsx @@ -22,6 +22,7 @@ export function Figure({ node }: { node: GenericNode }) { placeholder={placeholder} title={node.source?.title} url={node.source?.url} + location={node.source?.location} >