Skip to content

Commit

Permalink
Add example of add_linkcode_domain usage in linkcode docs
Browse files Browse the repository at this point in the history
  • Loading branch information
n-peugnet committed Jan 1, 2024
1 parent d6084d3 commit 54e8225
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions doc/usage/extensions/linkcode.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ Configuration
- ``javascript``: ``object`` (name of the object), ``fullname``
(name of the item)

Support for other domains can be added with
:py:meth:`.Sphinx.add_linkcode_domain()`.

Example:

.. code-block:: python
Expand All @@ -52,3 +49,14 @@ Configuration
return None
filename = info['module'].replace('.', '/')
return "https://somesite/sourcerepo/%s.py" % filename
Support for other domains can be added by extensions with
:py:meth:`.Sphinx.add_linkcode_domain()`.
For example, a Sphinx extension that adds support for the ``php`` domain
could use the following code to add support for the ``php`` domain
in :mod:`~sphinx.ext.linkcode`:

.. code-block:: python
def setup(app):
app.add_linkcode_domain('php', ['namespace', 'class', 'fullname'])

0 comments on commit 54e8225

Please sign in to comment.