Open sarimabbas opened 5 months ago
Thank you for reporting this issue, I can confirm that it doesn't work. You can workaround the issue in the meantime by doing this:
import { defineMarkdocConfig, nodes, component } from '@astrojs/markdoc/config';
import shiki from '@astrojs/markdoc/shiki';
export default defineMarkdocConfig({
nodes: {
image: {
...nodes.image,
+ attributes: {
+ ...nodes.image.attributes,
+ __optimizedSrc: { type: "Object" }
+ },
render: component('./src/components/MarkdocImage.astro'),
},
},
});
and accessing __optimizedSrc
in your component.
Thank you for the help! The workaround worked for me! My component is:
---
import { Image } from "astro:assets";
interface Props {
alt: string;
__optimizedSrc: ImageMetadata;
}
const { alt, __optimizedSrc } = Astro.props;
---
<Image src={__optimizedSrc} alt={alt} />
I removed the typeof src === 'string'
case as I'm assuming __optimizedSrc
will always be of type ImageMetadata
?
will try to solve this issue!
Astro Info
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
What's the expected result?
Link to Minimal Reproducible Example
/projects/test
to see the markdoc page.https://stackblitz.com/edit/withastro-astro-pnpmhg?file=src%2Fcomponents%2FMarkdocImage.astro
Participation