-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
fix(gatsby-remark-images): update to accept alt as title when no title present #13489
fix(gatsby-remark-images): update to accept alt as title when no title present #13489
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @jamessimone and congratulations on your first contribution to Gatsby! Enjoy the swag 😉
Went ahead and cleaned up some code I noticed after approving! Hope you don't mind @jamessimone 🙂 |
@sidharthachatterjee not at all! Thank you for making this even better 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the snapshots, it looks like we introduced a bug where title
(used in other places) is always being set to alt
as opposed to only the showCaption
case!
Also maybe a good time to add tests for the showCaption behaviour
@sidharthachatterjee I went to add a test for this, but I wanted to ask first if there is a way to only run the tests for gatsby-remark-images. When I ran I saw that plugin-sharp is listed as a peer dependency to the project but perhaps the tests can only be run from the root gatsby level due to that? Just wanted to ensure I wasn't doing something wrong there. Thank you to you and @pieh for jumping on this! |
@jamessimone Sid had exact same issue with jest. I'm not sure why both of you have this issue and I don't ... But to move things forward - I added some basic tests for |
Holy buckets, @jamessimone — we just merged your PR to Gatsby! 💪💜 Gatsby is built by awesome people like you. Let us say “thanks” in two ways:
If there’s anything we can do to help, please don’t hesitate to reach out to us: tweet at @gatsbyjs and we’ll come a-runnin’. Thanks again! |
Thank you so much @jamessimone and @pieh 🚀 |
Description
Some image sources only allow the setting of the alt image attribute when creating images in markdown. An example of this is Dropbox Paper. It would be nice to use the alt as the title for the image when no title is present and the showCaptions config value is enabled.
Related Issues
Fixes #13448