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

gatsby-remark-images not show captions in md file #13448

Closed
XHMM opened this issue Apr 18, 2019 · 2 comments · Fixed by #13489
Closed

gatsby-remark-images not show captions in md file #13448

XHMM opened this issue Apr 18, 2019 · 2 comments · Fixed by #13489

Comments

@XHMM
Copy link
Contributor

XHMM commented Apr 18, 2019

When i write image like this ![my image](../img.jpg) in markdown file ,
gatsby-remark-images not show captions (because source code only detect img.title),

(PS: I have enabled showCaptions in gatsby-config.js file)

so I have to write like <img src="../img.jpg" title="my image"></img> instead.
But when I switched to use gatsby-mdx later,
<img src="../img.jpg" title="my image"></img> not worked (I watched output, src not replaced by processed images under static files, maybe a bug?) ,

so I have to write back ![my image](../img.jpg) again,
but captions not showed in this way,

so can you change const showCaptions = options.showCaptions && node.title (source code ) to const showCaptions = options.showCaptions && (node.title || node.alt) or add something else to detect if image is written in ![my image](../img.jpg) style and add captions to it?

@DSchau
Copy link
Contributor

DSchau commented Apr 18, 2019

This seems reasonable! We'd happily take a PR.

@jamessimone
Copy link
Contributor

@DSchau saw your comment on this yesterday and submitted a PR for the issue this morning. Let me know what you think!

Thanks,
James

sidharthachatterjee pushed a commit that referenced this issue Apr 19, 2019
…e present (#13489)

* Fixes #13448

* Clean up

* update snapshot

* affect only caption

* don't manually bump version

* add basic tests for showCaptions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants