Skip to content

Commit 0ec6167

Browse files
author
georg.brandl
committed
Copy over docs on advanced role features from Sphinx docs.
git-svn-id: http://svn.python.org/projects/python/trunk@68973 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent dbbae1e commit 0ec6167

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

Doc/documenting/markup.rst

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,10 +290,22 @@ they should be marked simply with ``*var*``.
290290

291291
For all other roles, you have to write ``:rolename:`content```.
292292

293-
.. note::
293+
There are some additional facilities that make cross-referencing roles more
294+
versatile:
295+
296+
* You may supply an explicit title and reference target, like in reST direct
297+
hyperlinks: ``:role:`title <target>``` will refer to *target*, but the link
298+
text will be *title*.
299+
300+
* If you prefix the content with ``!``, no reference/hyperlink will be created.
301+
302+
* For the Python object roles, if you prefix the content with ``~``, the link
303+
text will only be the last component of the target. For example,
304+
``:meth:`~Queue.Queue.get``` will refer to ``Queue.Queue.get`` but only
305+
display ``get`` as the link text.
294306

295-
For all cross-referencing roles, if you prefix the content with ``!``, no
296-
reference/hyperlink will be created.
307+
In HTML output, the link's ``title`` attribute (that is e.g. shown as a
308+
tool-tip on mouse-hover) will always be the full target name.
297309

298310
The following roles refer to objects in modules and are possibly hyperlinked if
299311
a matching identifier is found:

0 commit comments

Comments
 (0)