Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MDX] Support img component prop for optimized images #8468

Merged
merged 5 commits into from
Sep 13, 2023

Conversation

bholmesdev
Copy link
Contributor

Changes

Respect the img component prop / export for images optimized via astro:assets. This will pass an ImageMetadata object as the src property to any img component when an optimized image is used.

Testing

  • test components property as export, esm import, and content collection entry

Docs

  • docs draft in CHANGELOG
  • official docs still TODO until we decide we like this!

@changeset-bot
Copy link

changeset-bot bot commented Sep 8, 2023

🦋 Changeset detected

Latest commit: 783e31f

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the pkg: integration Related to any renderer integration (scope) label Sep 8, 2023
@bholmesdev
Copy link
Contributor Author

I'm debating if this is a major, since it will now pass ImageMetadata for optimized images (see changeset). Could be breaking, or just a "new feature" since we didn't respect the img export at all before this change 🤔

Copy link
Member

@natemoo-re natemoo-re left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

major is probably safer given that users may need to update their existing code, but if users couldn't actually use img previously, I think minor makes sense.

Code LGTM.

Copy link
Member

@Princesseuh Princesseuh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You went much further than I would've had I implemented this myself, awesome work!

@Princesseuh Princesseuh merged commit a8d72ce into main Sep 13, 2023
13 checks passed
@Princesseuh Princesseuh deleted the fix/mdx-image-component branch September 13, 2023 16:27
@astrobot-houston astrobot-houston mentioned this pull request Sep 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: integration Related to any renderer integration (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

img MDX component override is not used in Astro collections
3 participants