Skip to content

Commit

Permalink
🌳 Correctly select figures with outputs and get figure node (#263)
Browse files Browse the repository at this point in the history
  • Loading branch information
stevejpurves authored Nov 14, 2023
1 parent 8b85cdb commit efceca7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/four-forks-begin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@myst-theme/jupyter': patch
---

correctly select figures with outputs and get figure node
12 changes: 7 additions & 5 deletions packages/jupyter/src/execute/provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
},
);
}

/**
Expand Down

0 comments on commit efceca7

Please sign in to comment.