-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1044 from sphinx-contrib/linkcode-improvements
`sphinx.ext.linkcode` Improvements
- Loading branch information
Showing
9 changed files
with
87 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
extensions = [ | ||
'sphinxcontrib.confluencebuilder', | ||
'sphinx.ext.linkcode', | ||
] | ||
|
||
def linkcode_resolve(domain, info): | ||
name = info.get('fullname', None) | ||
if not name: | ||
return None | ||
return f'https://example.org/src/{name}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
linkcode | ||
======== | ||
|
||
.. module:: example | ||
|
||
.. class:: ExampleModule | ||
|
||
This is an example. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[tox] | ||
package_root={toxinidir}{/}..{/}..{/}.. | ||
|
||
[testenv] | ||
commands = | ||
{envpython} -m tests.test_sample {posargs} | ||
setenv = | ||
PYTHONDONTWRITEBYTECODE=1 | ||
TOX_INI_DIR={toxinidir} | ||
passenv = * | ||
use_develop = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,4 +11,5 @@ found inside the internal tree. | |
autosummary | ||
graphviz | ||
inheritance_diagram | ||
linkcode | ||
todo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
sphinx.ext.linkcode | ||
=================== | ||
|
||
.. hint:: | ||
|
||
This requires registering the ``sphinx.ext.linkcode`` extension in the | ||
documentation's configuration file. | ||
|
||
This page shows an example of the linkcode_ extension's capabilities. A | ||
project configuration defines a ``linkcode_resolve`` function: | ||
|
||
.. code-block:: python | ||
def linkcode_resolve(domain, info): | ||
name = info.get('fullname', None) | ||
if not name: | ||
return None | ||
return "https://example.org/src/%s" % name | ||
When documents include object descriptions such as the following, source | ||
links should be included: | ||
|
||
.. code-block:: none | ||
.. class:: ExampleModule | ||
This is an example. | ||
Output | ||
------ | ||
|
||
The following shows an example of linkcode: | ||
|
||
.. module:: linkcode_example | ||
|
||
.. class:: ExampleModule | ||
|
||
This is an example. | ||
|
||
|
||
.. references ------------------------------------------------------------------ | ||
.. _linkcode: https://www.sphinx-doc.org/en/master/usage/extensions/linkcode.html |