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

Annoying links to original on scaled images #4229

Closed
txomon opened this issue Nov 9, 2017 · 18 comments
Closed

Annoying links to original on scaled images #4229

txomon opened this issue Nov 9, 2017 · 18 comments
Labels
builder:html type:proposal a feature suggestion

Comments

@txomon
Copy link

txomon commented Nov 9, 2017

Subject: It's annoying to have all rescaled images linked to original one always

Problem

  • If you rescale anything, even an icon, sphinx will generate a link to it

Procedure to reproduce the problem

Scale an image.

Expected results

Can we just add an option to image to avoid the generation of the link?

Environment info

  • OS: Linux
  • Python version: 3.6
  • Sphinx version: latest
  • html builder

I can make a PR, but just want confirmation that it would be accepted. Although maybe it exists already...

@tk0miya
Copy link
Member

tk0miya commented Nov 11, 2017

How about html_scaled_image_link?

@txomon
Copy link
Author

txomon commented Nov 11, 2017 via email

@tk0miya
Copy link
Member

tk0miya commented Nov 11, 2017

Ah, I understand. sorry, html_scaled_image_link is not good.
Indeed, such a hyperlink is not needed. Yes, any contribution is always welcome :-)
I think no option is needed. It's reasonable behavior to me.

@tk0miya tk0miya added type:proposal a feature suggestion and removed type:question labels Nov 11, 2017
@txomon
Copy link
Author

txomon commented Nov 11, 2017 via email

@tk0miya
Copy link
Member

tk0miya commented Nov 12, 2017

AFAIK the thumbnail images are used only if users uses :scale:, :width: or :height: options for images. So it is possible to know the conversion is needed or not. I think a hyperlink is not needed for not converted images even if these options are specified.

@txomon
Copy link
Author

txomon commented Nov 12, 2017

Yes, my question is, how do we deactivate the hyperlink generation when those images are specified?

.. image:: something.jpg
   :scale: 50
   :nolink:

my proposal was to add an option, and you seemed to say that no option is needed, so I am asking what solution would you propose.

Sorry if I wasn't clear enough =)

@tk0miya
Copy link
Member

tk0miya commented Nov 15, 2017

Ah, sorry. I'd misunderstood your request. Okay, you'd like to disable hyperlinks of specific images, right?
I'd like to hear you why do you want to disable specific ones?

I think we have to be careful to add a new option by Sphinx to keep syntax simple. So I'd like to know the reason.

@txomon
Copy link
Author

txomon commented Nov 15, 2017

I'd like to hear you why do you want to disable specific ones?

It's part of the problem description when I opened the issue. It doesn't make sense to have a link in an icon.

Another alternative I had thought of was to put some null link or something in the link in the existing :target: option, but couldn't figure it out. I am really open to suggestions

@RGSchuster
Copy link

I may be too new to Sphinx, but could you add a feature, say html_icon_image_link that, when set to false, disables the post_process_images function for images below a certain size?

@txomon
Copy link
Author

txomon commented Nov 15, 2017 via email

@tony
Copy link
Contributor

tony commented Feb 21, 2018

I don't think html_scaled_image_link is sufficient because I want to preserve the link behavior by default. I want to opt-out of the link for scaled images.

So I like the :nolink: idea.

tony added a commit to git-pull/website that referenced this issue Feb 21, 2018
This removes href's which are automatically being
added to scaled logos on consulting pages.

See also: sphinx-doc/sphinx#4229
@mgeier
Copy link
Contributor

mgeier commented Nov 2, 2018

👍 for the :nolink: option (or something similar)!

I've used the :width: and :height: option for reST content that is auto-generated by a Sphinx extension, where having a link to the full-sized image doesn't make sense (see spatialaudio/nbsphinx#226 and spatialaudio/nbsphinx#222).

However there may be user-generated reST pages in the same Sphinx project where the link indeed does make sense, so using html_scaled_image_link = False isn't really an option.

tony added a commit to git-pull/website that referenced this issue Sep 10, 2019
This removes href's which are automatically being
added to scaled logos on consulting pages.

See also: sphinx-doc/sphinx#4229
@jmckenna
Copy link

jmckenna commented May 9, 2020

agreed with @txomon, we really need a :nolink: option for Sphinx image directives (I keep hitting this issue).

@tk0miya
Copy link
Member

tk0miya commented May 9, 2020

I added a new style option :class: no-scaled-link since Sphinx-2.4 (refs: #7032).
I think this issue was already fixed, right?

@mgeier
Copy link
Contributor

mgeier commented May 9, 2020

Thanks @tk0miya!
I've used this in spatialaudio/nbsphinx#461 and it works great!

But are you sure about the version number 2.4?
AFAICT #7032 is available since Sphinx 3.0.0b1. Or am I missing something?
See #7062 (comment).

@jmckenna
Copy link

jmckenna commented May 9, 2020

oh true @tk0miya confirmed, works great! (with 3.0.3) Sorry for my misunderstanding.

@tk0miya
Copy link
Member

tk0miya commented May 9, 2020

oh, sorry. It was released as 3.0. I saw wrongly the milestone of #7032.

@tk0miya
Copy link
Member

tk0miya commented May 9, 2020

Closing. Thank you for discussing!

@tk0miya tk0miya closed this as completed May 9, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
builder:html type:proposal a feature suggestion
Projects
None yet
Development

No branches or pull requests

6 participants