Skip to content

Commit 02cc1df

Browse files
committed
DOC: Use two underscores for links with embedded URLs
Closes #13613.
1 parent 2b7e3ad commit 02cc1df

File tree

1 file changed

+25
-4
lines changed

1 file changed

+25
-4
lines changed

doc/usage/restructuredtext/basics.rst

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,32 @@ Hyperlinks
208208
External links
209209
~~~~~~~~~~~~~~
210210

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

215-
.. important:: There must be a space between the link text and the opening \< for the URL.
214+
To create text with a link, it's advisable to put the URL below the paragraph
215+
like this (:duref:`ref <hyperlink-targets>`)::
216+
217+
This is a paragraph that contains `a link`_.
218+
219+
.. _a link: https://domain.invalid/
220+
221+
This keeps the paragraph more readable in source code.
222+
223+
Alternatively, you can embed the URL using the syntax
224+
```Link text <https://domain.invalid/>`__``
225+
(:duref:`ref <embedded-uris-and-aliases>`).
226+
227+
.. important::
228+
229+
There must be a space between the link text and the opening \< for the URL.
230+
231+
Use two trailing underscores when embedding the URL. - Technically, a
232+
single underscore works as well, but that would create a named reference
233+
instead of an anonymous one. Named references typically do not have a
234+
benefit when the URL is embedded. However, they have the disadvantage that
235+
you must make sure that you do not use "Link text" in another link in your
236+
document.
216237

217238
You can also separate the link and the target definition (:duref:`ref
218239
<hyperlink-targets>`), like this::

0 commit comments

Comments
 (0)