diff --git a/.changeset/large-countries-cheer.md b/.changeset/large-countries-cheer.md new file mode 100644 index 000000000..b68723ff8 --- /dev/null +++ b/.changeset/large-countries-cheer.md @@ -0,0 +1,5 @@ +--- +'myst-cli': patch +--- + +Prevent html outputs that translate to empty images diff --git a/packages/myst-cli/src/transforms/outputs.ts b/packages/myst-cli/src/transforms/outputs.ts index ea014c752..a632a6797 100644 --- a/packages/myst-cli/src/transforms/outputs.ts +++ b/packages/myst-cli/src/transforms/outputs.ts @@ -279,6 +279,9 @@ export function reduceOutputs( ], }; htmlTransform(htmlTree); + if ((selectAll('image', htmlTree) as GenericNode[]).find((htmlImage) => !htmlImage.url)) { + return undefined; + } return htmlTree.children; } else if (content_type.startsWith('image/')) { const path = writeCachedOutputToFile(session, hash, cache.$outputs[hash], writeFolder, {