Sphinx: Annoying links to original on scaled images

Created on 9 Nov 2017  Â·  18Comments  Â·  Source: sphinx-doc/sphinx

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...

html proposal

Most helpful comment

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 =)

All 18 comments

How about html_scaled_image_link?

I do want that pictures that are scaled actually have a link to originals,
that's just fine. But there are small ones like icons etc that just don't
make sense =)

On Sat, Nov 11, 2017, 08:34 Takeshi KOMIYA notifications@github.com wrote:

How about html_scaled_image_link?

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/sphinx-doc/sphinx/issues/4229#issuecomment-343649609,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAN7mvHp6QuQROx4wInBwMPtVOeGqM70ks5s1VwggaJpZM4QYh-B
.

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.

When you mean no option, you mean that no additional attribute for
..image:: is required? If so, what method for not generating the link do
you propose?

On Sat, Nov 11, 2017, 12:20 Takeshi KOMIYA notifications@github.com wrote:

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.

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/sphinx-doc/sphinx/issues/4229#issuecomment-343660926,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAN7moS4zbQ7mTtY2E3IEmHCG6XF0FtDks5s1ZD6gaJpZM4QYh-B
.

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.

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 =)

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.

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

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?

In my case it's just for specific images. I wouldn't do it also dependant
on below a certain size, but just disabled by image. The use case is just
for certain images, is not something general. I could have another image
set to 50% scale and be an image I want a link for...

On Wed, Nov 15, 2017 at 6:03 PM RGSchuster notifications@github.com wrote:

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?

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/sphinx-doc/sphinx/issues/4229#issuecomment-344677546,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAN7mg-TxrFV2-6HaIOoGYRxzHRRSlecks5s2yeDgaJpZM4QYh-B
.

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.

:+1: 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 https://github.com/spatialaudio/nbsphinx/issues/226 and https://github.com/spatialaudio/nbsphinx/pull/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.

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

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

Thanks @tk0miya!
I've used this in https://github.com/spatialaudio/nbsphinx/pull/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 https://github.com/sphinx-doc/sphinx/pull/7062#discussion_r422504497.

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

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

Closing. Thank you for discussing!

Was this page helpful?
0 / 5 - 0 ratings