Skip to content

Commit e87bf24

Browse files
authored
References for config file values (#7859)
This adds crossrefs to the docs, a follow-up of #7652 (crossrefs to standard library items) and #7784 (crossrefs for command line options), only now for the config file values. Signed-off-by: Oleg Höfling <[email protected]>
1 parent 8b43fb2 commit e87bf24

File tree

2 files changed

+350
-79
lines changed

2 files changed

+350
-79
lines changed

docs/source/conf.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
import sys
1616
import os
1717

18+
from sphinx.application import Sphinx
19+
from sphinx.util.docfields import Field
20+
1821
# If extensions (or modules to document with autodoc) are in another directory,
1922
# add these directories to sys.path here. If the directory is relative to the
2023
# documentation root, use os.path.abspath to make it absolute, like shown here.
@@ -275,3 +278,16 @@
275278
'monkeytype': ('https://monkeytype.readthedocs.io/en/latest', None),
276279
'setuptools': ('https://setuptools.readthedocs.io/en/latest', None),
277280
}
281+
282+
283+
def setup(app: Sphinx) -> None:
284+
app.add_object_type(
285+
'confval',
286+
'confval',
287+
objname='configuration value',
288+
indextemplate='pair: %s; configuration value',
289+
doc_field_types=[
290+
Field('type', label='Type', has_arg=False, names=('type',)),
291+
Field('default', label='Default', has_arg=False, names=('default',)),
292+
]
293+
)

0 commit comments

Comments
 (0)