diff --git a/.changeset/four-forks-begin.md b/.changeset/four-forks-begin.md new file mode 100644 index 000000000..57923c48b --- /dev/null +++ b/.changeset/four-forks-begin.md @@ -0,0 +1,5 @@ +--- +'@myst-theme/jupyter': patch +--- + +correctly select figures with outputs and get figure node diff --git a/packages/jupyter/src/execute/provider.tsx b/packages/jupyter/src/execute/provider.tsx index 71c1df2f1..ab6d0556b 100644 --- a/packages/jupyter/src/execute/provider.tsx +++ b/packages/jupyter/src/execute/provider.tsx @@ -91,11 +91,13 @@ function useExecutionScopeFetcher({ } function listComputables(mdast: GenericParent) { - return selectAll('container[kind=figure] > output, embed > output', mdast).map((node: any) => { - const { key, label, source } = node; - const output = selectAll('output', node); - return { embedKey: key, outputKey: (output[0] as any).key, label, source }; - }); + return selectAll('container[kind=figure]:has(output), embed:has(output)', mdast).map( + (node: any) => { + const { key, label, source } = node; + const output = selectAll('output', node); + return { embedKey: key, outputKey: (output[0] as any).key, label, source }; + }, + ); } /**