-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Support adding a target to a link (to open in new tab) #12477
Comments
Heya, I'm afraid you are going to be more specific here: |
Currently, all links are internal from the same browser tab. The feature request is for an equivalent of html link |
This is one of those cases where browser tech with right+click "open in new tab" ends up giving almost the same result.
I suppose it would be a pretty dope feature to have in Sphinx core. However, I don't know of another documentation generation tool that's open source, multi-language, tries to support the whole Python ecosystem, and has a ton of free features like search, automatic index, i18n , etc... And actually works as well as Sphinx does. This leads me to think that the builtin nicety that's "open link in new tab" was never considered a priority by the community because simple workarounds are available, but pretty much every other feature/fix in Sphinx would leave devs without viable alternatives elsewhere. Did someone in the ecosystem write a custom extension that allows this? Is there some previous work somewhere? |
Well, actually, I believe this is already in myst-parser 😉 executablebooks/MyST-Parser#857 and sphinx already supports having a sphinx/sphinx/writers/html5.py Lines 326 to 327 in f85f50e
(not a rel though I don't think 🤔)
So then, for reStructureText, it just depends how do you want to set |
@chrisjsewell a couple of old SO threads Add open-in-new-tab links in Sphinx/reStructuredText and Open a link in a new window in reStructuredText which has an answer from SHIMIZUKAWA himself :) linking back to #1634 |
@dylanh724 have you encountered https://github.com/ftnext/sphinx-new-tab-link ? I think it might do what you want here - it's an extension (available on PyPi) that processes hyperlinks in your project and adds |
Great find! Thank you! It's up to you guys whether you want to keep this open or closed: Closed since I'm satisfied, or open if you wanted to absorb it into your main product (it still feels strange this isn't a native feat!). Cheers! A real scenario of when you'd want to use this: We may have "Chat With Us Now!" -- You don't know if it's a Discord link or an in-app chat box, for example. You could look at the bottom-left url preview, but the average person just clicks before they think. |
It seems there are accessibility concerns over the feature, as one of the more experienced maintainers said here. (IOW it might work fine for the average user but would be problematic for folks using screen readers...)
Noting the W3C recommendation against it, more specifically:
|
Not planned as a feature for core |
Is your feature request related to a problem? Please describe.
In 2024, you generally don't need to deep Google just to see if they support external links, a feature as old as the internet. This seems to possibly be the only web project that has no native external link support: I believe it's time.
Describe the solution you'd like
Please include native support for external links opposed to dirty js workarounds.
Describe alternatives you've considered
Creating a custom .js file.
The text was updated successfully, but these errors were encountered: