Skip to content

Only use ~ in class ref to hide prefix #78

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

Merged
merged 2 commits into from
Mar 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion pandas/guide/_sources/pandas_docstring.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
<http://www.sphinx-doc.org/en/stable/domains.html#cross-referencing-syntax>`_
for details.

**Good:**

.. code-block:: python
Expand Down
10 changes: 9 additions & 1 deletion pandas/guide/pandas_docstring.html
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,18 @@ <h2>About docstrings and standards<a class="headerlink" href="#about-docstrings-
<li>The name of a parameter</li>
<li>Python code, a module, function, built-in, type, literal… (e.g. <code class="docutils literal notranslate"><span class="pre">os</span></code>,
<code class="docutils literal notranslate"><span class="pre">list</span></code>, <code class="docutils literal notranslate"><span class="pre">numpy.abs</span></code>, <code class="docutils literal notranslate"><span class="pre">datetime.date</span></code>, <code class="docutils literal notranslate"><span class="pre">True</span></code>)</li>
<li>A pandas class (in the form <code class="docutils literal notranslate"><span class="pre">:class:`~pandas.Series`</span></code>)</li>
<li>A pandas class (in the form <code class="docutils literal notranslate"><span class="pre">:class:`pandas.Series`</span></code>)</li>
<li>A pandas method (in the form <code class="docutils literal notranslate"><span class="pre">:meth:`pandas.Series.sum`</span></code>)</li>
<li>A pandas function (in the form <code class="docutils literal notranslate"><span class="pre">:func:`pandas.to_datetime`</span></code>)</li>
</ul>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">To display only the last component of the linked class, method or
function, prefix it with <code class="docutils literal notranslate"><span class="pre">~</span></code>. For example, <code class="docutils literal notranslate"><span class="pre">:class:`~pandas.Series`</span></code>
will link to <code class="docutils literal notranslate"><span class="pre">pandas.Series</span></code> but only display the last part, <code class="docutils literal notranslate"><span class="pre">Series</span></code>
as the link text. See <a class="reference external" href="http://www.sphinx-doc.org/en/stable/domains.html#cross-referencing-syntax">Sphinx cross-referencing syntax</a>
for details.</p>
</div>
<p><strong>Good:</strong></p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="nf">add_values</span><span class="p">(</span><span class="n">arr</span><span class="p">):</span>
<span class="sd">&quot;&quot;&quot;</span>
Expand Down
Loading