From 72fa607add499de9fe3db6750ce61176f14fc296 Mon Sep 17 00:00:00 2001 From: Rowan Cockett Date: Thu, 9 Jan 2025 23:18:03 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=99=88=20Remove=20hidden=20output=20nodes?= =?UTF-8?q?=20from=20static=20exports?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .changeset/twelve-onions-smile.md | 5 +++++ packages/myst-cli/src/transforms/outputs.ts | 5 +++++ 2 files changed, 10 insertions(+) create mode 100644 .changeset/twelve-onions-smile.md diff --git a/.changeset/twelve-onions-smile.md b/.changeset/twelve-onions-smile.md new file mode 100644 index 000000000..2b6b9533f --- /dev/null +++ b/.changeset/twelve-onions-smile.md @@ -0,0 +1,5 @@ +--- +"myst-cli": patch +--- + +Remove hidden output nodes from PDF exports diff --git a/packages/myst-cli/src/transforms/outputs.ts b/packages/myst-cli/src/transforms/outputs.ts index a632a6797..7046450e7 100644 --- a/packages/myst-cli/src/transforms/outputs.ts +++ b/packages/myst-cli/src/transforms/outputs.ts @@ -236,6 +236,11 @@ export function reduceOutputs( const outputs = selectAll('output', mdast) as GenericNode[]; const cache = castSession(session); outputs.forEach((node) => { + if (node.visibility === 'remove' || node.visibility === 'hide') { + // Hidden nodes should not show up in simplified outputs for static export + node.type = '__delete__'; + return; + } if (!node.data?.length && !node.children?.length) { node.type = '__delete__'; return;