From 1dd275279797ce009e88604d3671f5aee5a4348d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Israel=20Saeta=20P=C3=A9rez?= Date: Sun, 18 Mar 2018 18:48:08 +0100 Subject: [PATCH] DOC: Only use ~ in class links to hide prefixes. This is ported from https://github.com/python-sprints/python-sprints.github.io/pull/78/. --- doc/source/contributing_docstring.rst | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/doc/source/contributing_docstring.rst b/doc/source/contributing_docstring.rst index cd56b76fa891b..c210bb7050fb8 100644 --- a/doc/source/contributing_docstring.rst +++ b/doc/source/contributing_docstring.rst @@ -107,10 +107,18 @@ backticks. It is considered inline code: - The name of a parameter - Python code, a module, function, built-in, type, literal... (e.g. ``os``, ``list``, ``numpy.abs``, ``datetime.date``, ``True``) -- A pandas class (in the form ``:class:`~pandas.Series```) +- A pandas class (in the form ``:class:`pandas.Series```) - A pandas method (in the form ``:meth:`pandas.Series.sum```) - A pandas function (in the form ``:func:`pandas.to_datetime```) +.. note:: + To display only the last component of the linked class, method or + function, prefix it with ``~``. For example, ``:class:`~pandas.Series``` + will link to ``pandas.Series`` but only display the last part, ``Series`` + as the link text. See `Sphinx cross-referencing syntax + `_ + for details. + **Good:** .. code-block:: python