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

👌 IMPROVE: Allow for opening external links in new tabs (#856) #857

Merged
merged 2 commits into from
Mar 26, 2024

Conversation

marjus45
Copy link
Contributor

@marjus45 marjus45 commented Jan 5, 2024

Add support to enable external links to open in a new tab. Expose the configuration option myst_links_external_new_tab, which if set will set all URL links to open in a new tab on the browser.

Besides that, we allow the user to set the target and rel attributes when using the extension inline_attrs (#820).

Closes #820
Closes #856

Copy link

welcome bot commented Jan 5, 2024

Thanks for submitting your first pull request! You are awesome! 🤗

If you haven't done so already, check out EBP's Code of Conduct and our Contributing Guide, as this will greatly help the review process.

Welcome to the EBP community! 🎉

Copy link
Member

@chrisjsewell chrisjsewell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heya thanks,

Could you add/update some test fixtures in tests/test_renderers/test_myst_config.py, to test both the global config and the attrs_inline

For example see: https://github.com/executablebooks/MyST-Parser/blob/master/tests/test_renderers/fixtures/myst-config.txt#L461

Add support to enable external links to open in a new tab. Expose the
configuration option myst_links_external_new_tab, which if set will set
all URL links to open in a new tab on the browser.

Besides that, we allow the user to set the target and rel attributes
when using the extension inline_attrs (executablebooks#820).

Closes executablebooks#820
Closes executablebooks#856

Signed-off-by: Marjus Cako <marios.cako@hpe.com>
@marjus45
Copy link
Contributor Author

Thanks a lot for the pointer @chrisjsewell . I updated my commit with a couple of tests for these features. Please let me know if that will suffice!

@chrisjsewell chrisjsewell changed the title 👌 IMPROVE: External links in new tab (#856) 👌 IMPROVE: Allow for opening external links in new tabs (#856) Mar 26, 2024
@codecov-commenter
Copy link

codecov-commenter commented Mar 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.10%. Comparing base (abcc087) to head (06a63f3).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #857      +/-   ##
==========================================
+ Coverage   90.09%   90.10%   +0.01%     
==========================================
  Files          24       24              
  Lines        3372     3377       +5     
==========================================
+ Hits         3038     3043       +5     
  Misses        334      334              
Flag Coverage Δ
pytests 90.10% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@chrisjsewell chrisjsewell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great cheers!

@chrisjsewell chrisjsewell merged commit 6daae24 into executablebooks:master Mar 26, 2024
20 checks passed
Copy link

welcome bot commented Mar 26, 2024

Congrats on your first merged pull request in this project! 🎉
congrats

Thank you for contributing, we are very proud of you! ❤️

chrisjsewell added a commit to sphinx-doc/sphinx that referenced this pull request Jun 28, 2024
See https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel,
this allows third-party extensions to set this attribute on the node and have it propagate to the output HTML,
for example executablebooks/MyST-Parser#857
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Open external URLs in a new tab Add support for the keys "target" and "rel" in inline_attrs
3 participants