Skip to content

Commit 7273ea0

Browse files
dukebodyjorisvandenbossche
authored andcommitted
DOC: Only use ~ in class links to hide prefixes. (#20402)
This is ported from python-sprints/python-sprints.github.io#78.
1 parent f4343b3 commit 7273ea0

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Diff for: doc/source/contributing_docstring.rst

+9-1
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,18 @@ backticks. It is considered inline code:
107107
- The name of a parameter
108108
- Python code, a module, function, built-in, type, literal... (e.g. ``os``,
109109
``list``, ``numpy.abs``, ``datetime.date``, ``True``)
110-
- A pandas class (in the form ``:class:`~pandas.Series```)
110+
- A pandas class (in the form ``:class:`pandas.Series```)
111111
- A pandas method (in the form ``:meth:`pandas.Series.sum```)
112112
- A pandas function (in the form ``:func:`pandas.to_datetime```)
113113

114+
.. note::
115+
To display only the last component of the linked class, method or
116+
function, prefix it with ``~``. For example, ``:class:`~pandas.Series```
117+
will link to ``pandas.Series`` but only display the last part, ``Series``
118+
as the link text. See `Sphinx cross-referencing syntax
119+
<http://www.sphinx-doc.org/en/stable/domains.html#cross-referencing-syntax>`_
120+
for details.
121+
114122
**Good:**
115123

116124
.. code-block:: python

0 commit comments

Comments
 (0)