Skip to content

Commit

Permalink
✍️ Add urlOptimized to myst-spec-ext
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanc1 committed Aug 31, 2024
1 parent 63f9265 commit 8d1c007
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/honest-pumpkins-return.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"myst-spec-ext": patch
---

Add urlOptimized to image type
2 changes: 1 addition & 1 deletion packages/myst-cli/src/transforms/images.ts
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ export async function transformWebp(
if (!fs.existsSync(imageWriteFolder)) return; // No images exist to copy - not necessarily an error
const writeFolderContents = fs.readdirSync(imageWriteFolder);
const { mdast, frontmatter } = postData;
const images = selectAll('image', mdast) as GenericNode[];
const images = selectAll('image', mdast) as Image[];
await Promise.all(
images.map(async (image) => {
if (!image.url) return;
Expand Down
1 change: 1 addition & 0 deletions packages/myst-spec-ext/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ export type Heading = SpecHeading &

export type Image = SpecImage & {
urlSource?: string;
urlOptimized?: string;
height?: string;
placeholder?: boolean;
};
Expand Down

0 comments on commit 8d1c007

Please sign in to comment.