Skip to content

Commit 88cc3e0

Browse files
committed
fix: handle visibility properly
1 parent db80c54 commit 88cc3e0

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

packages/myst-cli/src/transforms/outputs.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,12 +254,15 @@ export function reduceOutputs(
254254
const outputsNodes = selectAll('outputs', mdast) as GenericNode[];
255255
const cache = castSession(session);
256256
outputsNodes.forEach((outputsNode) => {
257-
const outputs = outputsNode.children as GenericNode[];
257+
// Hidden nodes should not show up in simplified outputs for static export
258+
if (outputsNode.visibility === 'remove' || outputsNode.visibility === 'hide') {
259+
outputsNode.type = '__delete__';
260+
return;
261+
}
258262

263+
const outputs = outputsNode.children as GenericNode[];
259264
outputs.forEach((outputNode) => {
260-
if (outputNode.visibility === 'remove' || outputNode.visibility === 'hide') {
261-
// Hidden nodes should not show up in simplified outputs for static export
262-
outputNode.type = '__delete__';
265+
if (outputNode.type !== 'output') {
263266
return;
264267
}
265268
// Lift the `output` node into `Outputs`

0 commit comments

Comments
 (0)