-
Notifications
You must be signed in to change notification settings - Fork 2
Don't create figures from images without caption #7
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
Conversation
Also (not to bloat the PR description): thank you @yilei for this nice library! It helps a lot. |
Thanks for the PR, I'm glad you find this extension useful! I used standalone images without captions on my site, i.e. relying on the current behavior. Instead of changing the default, could you please make this an option to opt-in? The Thanks! |
Thanks for the feedback @yilei - it's done! |
Thanks for making the changes! I made a small tweak to the if statement. Merging. |
Also made a new release: https://github.com/mangoumbrella/goldmark-figure/releases/tag/v1.3.0 |
Cool, thanks! :) |
Right now the library creates a
<figure>
element even when an image doesn't have caption.For example this:
Will be turned into this:
This is a problem in real life for websites like the "About" page of my blog:
As can be seen here, the image link is to my profile picture, standing on it's own, which I definitely don't want to turn into a
<figure>
.This PR fixes this by not adding a
<figure>
element when there's no text right after the imagine in Markdown. Please refer to the newly addedd test to see it in action.