Skip to content

Use anonymous references for links with embedded URLs #13615

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

timhoffm
Copy link
Contributor

@timhoffm timhoffm commented Jun 4, 2025

Closes #13613.

The explanation got a bit longer than I would have liked. But I think it's important to make people aware that they should use two underscoes even though one may also work. And if we do that, we need to briefly explain the difference.

@timhoffm timhoffm force-pushed the doc-external-links branch from b0ff0f7 to bd1adac Compare June 4, 2025 22:01
Copy link
Contributor

@jfbu jfbu left a comment

Choose a reason for hiding this comment

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

LGTM with nits.

There is one more syntax but it would be confusing to state it here. It is `Link text <goto_>`__, with the .. _goto: standing after the paragraph. As I reported at #13576 (comment), with Docutils 0.21.2, even with a single underscore one could use this with identical Link text e.g. See `DOI <goto1_>`_ or `DOI <goto2_>`_ without Docutils raising warnings but this is no more true since Docutils r10151.

Use ```Link text <https://domain.invalid/>`_`` for inline web links. If the
link text should be the web address, you don't need special markup at all, the
parser finds links and mail addresses in ordinary text.
URLs and email addresses in text are automatically linked an do no need explicit
Copy link
Contributor

Choose a reason for hiding this comment

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

typo(s) "an do no need"

Copy link
Contributor

Choose a reason for hiding this comment

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

Hello @timhoffm I do not know why but this is still standing as far as I can see, so I temporarily "unresolve" this conversation...

@AA-Turner AA-Turner changed the title DOC: Use two underscores for links with embedded URLs Use anonymous references for links with embedded URLs Jun 5, 2025
@AA-Turner
Copy link
Member

cc: @gmilde

@timhoffm timhoffm force-pushed the doc-external-links branch from bd1adac to 02cc1df Compare June 5, 2025 20:49
Use two trailing underscores when embedding the URL. - Technically, a
single underscore works as well, but that would create a named reference
instead of an anonymous one. Named references typically do not have a
benefit when the URL is embedded. However, they have the disadvantage that
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe s/However/Moreover/ in view of previous sentence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Misleading documentation on rST hyperlink syntax.
3 participants