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] Autolinking images overrides other links #6980

Closed
jlengstorf opened this issue Aug 2, 2018 · 0 comments · Fixed by #6982
Closed

[gatsby-remark-images] Autolinking images overrides other links #6980

jlengstorf opened this issue Aug 2, 2018 · 0 comments · Fixed by #6982
Labels
help wanted Issue with a clear description that the community can help with. type: bug An issue or pull request relating to a bug in Gatsby

Comments

@jlengstorf
Copy link
Contributor

Description

When using gatsby-remark-images, if the linkImagesToOriginal is set to true (which is the default), all images will be linked to their original, even if they're already wrapped in a link.

Steps to reproduce

# clone the repo
git clone https://github.com/jlengstorf/gatsby-remark-images-link-override-bug
cd gatsby-remark-images-link-override-bug/

# install dependencies
npm i

# start the repo
npm run develop

Load `http://localhost:8000/

Expected result

Images with links should preserve those links.

Actual result

Links are overridden with a link to the image. (Actually, they're double-wrapped, but the HTML parser drops the outer link.)

Environment

  System:
    OS: macOS High Sierra 10.13.6
    CPU: x64 Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 10.1.0 - ~/.nvm/versions/node/v10.1.0/bin/node
    Yarn: 1.9.2 - /usr/local/bin/yarn
    npm: 5.6.0 - ~/.nvm/versions/node/v10.1.0/bin/npm
  Browsers:
    Chrome: 68.0.3440.84
    Firefox: 60.0.2
    Safari: 11.1.2
  npmPackages:
    gatsby: next => 2.0.0-beta.66 
    gatsby-plugin-react-helmet: next => 3.0.0-beta.4 
    gatsby-plugin-sharp: next => 2.0.0-beta.7 
    gatsby-remark-images: next => 2.0.1-beta.9 
    gatsby-source-filesystem: next => 2.0.1-beta.10 
    gatsby-transformer-remark: next => 2.1.1-beta.5 
@jlengstorf jlengstorf added type: bug An issue or pull request relating to a bug in Gatsby help wanted Issue with a clear description that the community can help with. labels Aug 2, 2018
jlengstorf added a commit to jlengstorf/gatsby that referenced this issue Aug 3, 2018
@pieh pieh closed this as completed in #6982 Aug 6, 2018
pieh pushed a commit that referenced this issue Aug 6, 2018
…#6982)

* fix(gatsby-remark-images): don’t add links if image is already linked

fixes #6980
Co-authored-by: @pieh

* fix: handle weird nesting and mixed MD/HTML

* fix: remove bad check for parent links
porfirioribeiro pushed a commit to porfirioribeiro/gatsby that referenced this issue Aug 22, 2018
…gatsbyjs#6982)

* fix(gatsby-remark-images): don’t add links if image is already linked

fixes gatsbyjs#6980
Co-authored-by: @pieh

* fix: handle weird nesting and mixed MD/HTML

* fix: remove bad check for parent links
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Issue with a clear description that the community can help with. type: bug An issue or pull request relating to a bug in Gatsby
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant