Skip to content

Commit

Permalink
🎆 Prevent html outputs that translate to empty images (#1739)
Browse files Browse the repository at this point in the history
  • Loading branch information
fwkoch authored Jan 9, 2025
1 parent ea19e66 commit 93af5a1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/large-countries-cheer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'myst-cli': patch
---

Prevent html outputs that translate to empty images
3 changes: 3 additions & 0 deletions packages/myst-cli/src/transforms/outputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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, {
Expand Down

0 comments on commit 93af5a1

Please sign in to comment.