The Sphinx documentation generator
Go to file
Chris Sewell 04bd0df100
👌 Improve external role warnings (and revert object fallback) (#12193)
The key issue this commit seeks to address, is that existing tools / documentation often lead users to mistakenly use object types and not role names, a classic example being `function` not `func`

Previously, the warning message for using e.g. `` external:function`target` `` (with `py` as the default domain), would be:

```
WARNING: role for external cross-reference not found: function
```

This gives no information to the user on how to fix the issue, even though there is actually quite an easy fix

This commit adds logic to create more specific / helpful warning messages, e.g.

```
WARNING: role for external cross-reference not found in domains 'py', 'std': 'function' (perhaps you meant one of: 'py:func', 'py:obj')
```

This goes through the same original logic but, if the role is not found, it will look if the role name is actually an available object type on the domain(s), and then suggest its related roles.

This commit also reverts #12133, which provided a (silent) fallback to auto convert an object type to a role name.
2024-03-25 14:39:51 +01:00
.github CI: Print detailed Python version (#12176) 2024-03-22 18:10:35 +01:00
doc [doc] cleanup references and update external URLs (#12182) 2024-03-25 11:39:05 +01:00
sphinx 👌 Improve external role warnings (and revert object fallback) (#12193) 2024-03-25 14:39:51 +01:00
tests 👌 Improve external role warnings (and revert object fallback) (#12193) 2024-03-25 14:39:51 +01:00
utils 🔧 Ruff format python files within utils folder (#12142) 2024-03-19 19:32:28 +01:00
.codecov.yml Revert "Enable patch status check for Codecov" 2020-03-15 11:09:06 +09:00
.flake8 [doc] cleanup references and update external URLs (#12182) 2024-03-25 11:39:05 +01:00
.git-blame-ignore-revs Add 2024 copyright year update to `.git-blame-ignore-revs` 2024-01-16 22:15:22 +00:00
.gitignore [lint] ignore `venv` directory (#12138) 2024-03-19 11:07:08 +01:00
.mailmap Add git .mailmap file 2023-08-29 21:14:42 +01:00
.readthedocs.yml RTD builder: add graphviz depedendency (#11040) 2022-12-20 12:30:59 +00:00
.ruff.toml [doc] cleanup references and update external URLs (#12182) 2024-03-25 11:39:05 +01:00
AUTHORS.rst Add new maintainers 2024-01-15 08:11:51 +00:00
bindep.txt Update bindep.txt for LaTeX pict2e.sty optional dependency 2022-07-18 19:26:08 +02:00
CHANGES.rst 👌 Improve external role warnings (and revert object fallback) (#12193) 2024-03-25 14:39:51 +01:00
CODE_OF_CONDUCT.rst Adorn top-level files with a '.rst' suffix 2023-09-14 11:08:17 +01:00
CONTRIBUTING.rst Minor typo in the contributing info 2020-12-16 12:09:17 -05:00
EXAMPLES.rst [doc] cleanup references and update external URLs (#12182) 2024-03-25 11:39:05 +01:00
karma.conf.js Split out sphinx_highlight.js 2022-09-24 15:10:57 +01:00
LICENSE.rst Happy New Year! 2024-01-16 22:13:47 +00:00
Makefile [doc] cleanup references and update external URLs (#12182) 2024-03-25 11:39:05 +01:00
package-lock.json [javascript] Update vulnerable dependencies using 'npm audit fix'. (#12101) 2024-03-15 17:58:24 +01:00
package.json Merge branch '4.x' 2022-03-19 22:58:15 +09:00
pyproject.toml [tests] move utilities and static data into dedicated modules and remove `html5lib` (#12173) 2024-03-25 11:03:44 +01:00
README.rst [docs] Remove duplicate "the" from README file (#11835) 2024-01-01 15:39:09 +01:00
tox.ini Declare support for Python 3.13 2023-08-17 04:28:52 +01:00

========
 Sphinx
========

.. image:: https://img.shields.io/pypi/v/sphinx.svg
   :target: https://pypi.org/project/Sphinx/
   :alt: Package on PyPI

.. image:: https://github.com/sphinx-doc/sphinx/actions/workflows/main.yml/badge.svg
   :target: https://github.com/sphinx-doc/sphinx/actions/workflows/main.yml
   :alt: Build Status

.. image:: https://readthedocs.org/projects/sphinx/badge/?version=master
   :target: https://www.sphinx-doc.org/
   :alt: Documentation Status

.. image:: https://img.shields.io/badge/License-BSD%202--Clause-blue.svg
   :target: https://opensource.org/licenses/BSD-2-Clause
   :alt: BSD 2 Clause

**Sphinx makes it easy to create intelligent and beautiful documentation.**

Sphinx uses reStructuredText as its markup language, and many of its strengths
come from the power and straightforwardness of reStructuredText and its parsing
and translating suite, the Docutils.

Features
========

* **Output formats**: HTML, PDF, plain text, EPUB, TeX, manual pages, and more
* **Extensive cross-references**: semantic markup and automatic links
  for functions, classes, glossary terms and similar pieces of information
* **Hierarchical structure**: easy definition of a document tree, with automatic
  links to siblings, parents and children
* **Automatic indices**: general index as well as a module index
* **Code highlighting**: automatic highlighting using the Pygments highlighter
* **Templating**: Flexible HTML output using the Jinja 2 templating engine
* **Extension ecosystem**: Many extensions are available, for example for
  automatic function documentation or working with Jupyter notebooks.
* **Language Support**: Python, C, C++, JavaScript, mathematics, and many other
  languages through extensions.

For more information, refer to `the documentation`_.

Installation
============

The following command installs Sphinx from the `Python Package Index`_. You will
need a working installation of Python and pip.

.. code-block:: sh

   pip install -U sphinx

Contributing
============

We appreciate all contributions! Refer to `the contributors guide`_ for
information.

.. _the documentation: https://www.sphinx-doc.org/
.. _the contributors guide: https://www.sphinx-doc.org/en/master/internals/contributing.html
.. _Python Package Index: https://pypi.org/project/Sphinx/