docs icon indicating copy to clipboard operation
docs copied to clipboard

GH-5915 (Open external links in new tab)

Open chessmadridista opened this issue 1 year ago • 7 comments

Summary

This pull request helps the user open all internal links in the same tab and all the external links in a new tab.

A new open-external-links-in-new-tab.js file has been created. When the dom gets loaded, the target=_blank attribute is applied to all the external links. The JS file has been added to conf.py as well so that the application is aware of that script.

A generated preview of my work is requested (this step is mentioned in the issue).

Ticket Link

Fixes #5915.

chessmadridista avatar Jun 11 '24 09:06 chessmadridista

Hello @chessmadridista,

Thanks for your pull request! A Core Committer will review your pull request soon. For code contributions, you can learn more about the review process here.

mattermost-build avatar Jun 11 '24 09:06 mattermost-build

Hey @chessmadridista, thank you for your contribution!

I'm wondering why did you choose to use javascript for this. Is this not doable using a Sphinx extension? I'd rather have the HTML generated with this than adding javascript modifications if possible.

fmartingr avatar Jun 12 '24 16:06 fmartingr

@chessmadridista - I agree with @fmartingr that it's worth exploring whether our HTML generator, Sphinx, can do this for us, rather than modifying the DOM via scripting. Would you be open to looking into Sphinx capabilities in this area? We're currently using Sphinx 7.2.6.

cwarnermm avatar Jun 12 '24 16:06 cwarnermm

Hi @fmartingr and @cwarnermm, thank you for the feedback!

I was not aware of the solution involving Sphinx extension and the first solution that came to my mind was to manipulate the DOM via JavaScript.

I'll look in the documentation of Sphinx and will make the necessary modifications.

chessmadridista avatar Jun 12 '24 17:06 chessmadridista

@fmartingr and @cwarnermm

Also, I am contributing to open source for the first time so I am not sure about the process after review.

Should I delete the branch and start afresh with a new branch or should I commit the removal of these JavaScript code snippets and then commit the Sphinx method in this branch or should I do something else? What's the best practice?

chessmadridista avatar Jun 12 '24 17:06 chessmadridista

@fmartingr and @cwarnermm

Also, I am contributing to open source for the first time so I am not sure about the process after review.

Should I delete the branch and start afresh with a new branch or should I commit the removal of these JavaScript code snippets and then commit the Sphinx method in this branch or should I do something else? What's the best practice?

For me it's fine for you to continue here if needed so we can keep the conversation in one place; commits can be squashed later on merge :)

fmartingr avatar Jun 13 '24 06:06 fmartingr

This PR has been automatically labelled "stale" because it hasn't had recent activity. A core team member will check in on the status of the PR to help with questions. Thank you for your contribution!

mattermost-build avatar Jun 24 '24 01:06 mattermost-build

Closing due to inactivity.

cwarnermm avatar Jul 12 '24 18:07 cwarnermm

Hi @fmartingr, @cwarnermm and @amyblais, there is an issue in the Sphinx repo regarding this functionality. It seems that the only way to open external links is to use some form of JS.

Additionally, please take a look at this answer on StackOverflow. They are also saying that there is no inbuilt feature in Sphinx to achieve what we want.

There is an extension on PyPi to achieve the functionality that we want.

Please let me know about the next course of action.

chessmadridista avatar Jul 29 '24 06:07 chessmadridista