@@ -12,26 +12,26 @@ In ``docs/conf.py`` Intersphinx must be indicated as an extension:
12
12
13
13
.. code-block :: python
14
14
15
- extensions = [
16
- " sphinx.ext.intersphinx" ,
17
- ]
15
+ extensions = [
16
+ " sphinx.ext.intersphinx" ,
17
+ ]
18
18
19
19
External Sphinx documentation can then be specified, e.g. with:
20
20
21
21
.. code-block :: python
22
22
23
- intersphinx_mapping = {
24
- " python" : (" https://docs.python.org/3" , None ),
25
- " bokeh" : (" https://bokeh.pydata.org/en/latest/" , None ),
26
- }
23
+ intersphinx_mapping = {
24
+ " python" : (" https://docs.python.org/3" , None ),
25
+ " bokeh" : (" https://bokeh.pydata.org/en/latest/" , None ),
26
+ }
27
27
28
28
However, alternative files can also be specified for an inventory, for example:
29
29
30
30
.. code-block :: python
31
31
32
- intersphinx_mapping = {
33
- " python" : (" https://docs.python.org/3" , None , " python-inv.txt" ),
34
- }
32
+ intersphinx_mapping = {
33
+ " python" : (" https://docs.python.org/3" , None , " python-inv.txt" ),
34
+ }
35
35
36
36
Determine link targets
37
37
----------------------
@@ -41,12 +41,12 @@ for example:
41
41
42
42
.. code-block :: console
43
43
44
- $ python -m sphinx.ext.intersphinx https://docs.python.org/3/objects.inv
45
- c:function
46
- PyAnySet_Check c-api/set.html#c.PyAnySet_Check
47
- PyAnySet_CheckExact c-api/set.html#c.PyAnySet_CheckExact
48
- PyArg_Parse c-api/arg.html#c.PyArg_Parse
49
- …
44
+ $ python -m sphinx.ext.intersphinx https://docs.python.org/3/objects.inv
45
+ c:function
46
+ PyAnySet_Check c-api/set.html#c.PyAnySet_Check
47
+ PyAnySet_CheckExact c-api/set.html#c.PyAnySet_CheckExact
48
+ PyArg_Parse c-api/arg.html#c.PyArg_Parse
49
+ …
50
50
51
51
Create a link
52
52
-------------
@@ -57,17 +57,17 @@ of the following variants can be specified:
57
57
:c:func: `PyArg_Parse `
58
58
.. code-block :: rest
59
59
60
- :c:func:`PyArg_Parse`
60
+ :c:func:`PyArg_Parse`
61
61
62
62
:c:func: `!PyArg_Parse `
63
63
.. code-block :: rest
64
64
65
- :c:func:`!PyArg_Parse`
65
+ :c:func:`!PyArg_Parse`
66
66
67
67
:c:func: `Parsing arguments <PyArg_Parse> `
68
68
.. code-block :: rest
69
69
70
- :c:func:`Parsing arguments <PyArg_Parse>`
70
+ :c:func:`Parsing arguments <PyArg_Parse>`
71
71
72
72
Custom links
73
73
------------
@@ -82,50 +82,48 @@ The error can be corrected with:
82
82
83
83
.. code-block :: console
84
84
85
- $ python -m pip install sphobjinv
85
+ $ python -m pip install sphobjinv
86
86
87
87
#. Then the original file can be downloaded with:
88
88
89
89
.. code-block :: console
90
90
91
- $ cd docs/build/
92
- $ mkdir _intersphinx
93
- $ !$
94
- $ curl -O https://www.crummy.com/software/BeautifulSoup/bs4/doc/objects.inv
95
- $ mv objects.inv bs4_objects.inv
91
+ $ cd docs/build/
92
+ $ mkdir _intersphinx
93
+ $ !$
94
+ $ curl -O https://www.crummy.com/software/BeautifulSoup/bs4/doc/objects.inv
95
+ $ mv objects.inv bs4_objects.inv
96
96
97
97
#. Change the Sphinx configuration ``docs/conf.py ``:
98
98
99
99
.. code-block :: console
100
100
101
- intersphinx_mapping = {
102
- …
103
- 'bs4': ('https://www.crummy.com/software/BeautifulSoup/bs4/doc/', "_intersphinx/bs4_objects.inv")
101
+ intersphinx_mapping = {
102
+ …
103
+ 'bs4': ('https://www.crummy.com/software/BeautifulSoup/bs4/doc/', "_intersphinx/bs4_objects.inv")
104
104
}
105
105
106
106
#. Convert to a text file:
107
107
108
108
.. code-block :: console
109
109
110
- $ sphobjinv convert plain bs4_objects.inv bs4_objects.txt
110
+ $ sphobjinv convert plain bs4_objects.inv bs4_objects.txt
111
111
112
112
#. Editing the text file
113
113
114
- e.g.:
115
-
116
114
.. code-block :: console
117
115
118
- bs4.BeautifulSoup py:class 1 index.html#beautifulsoup -
119
- bs4.BeautifulSoup.get_text py:method 1 index.html#get-text -
120
- bs4.element.Tag py:class 1 index.html#tag -
116
+ bs4.BeautifulSoup py:class 1 index.html#beautifulsoup -
117
+ bs4.BeautifulSoup.get_text py:method 1 index.html#get-text -
118
+ bs4.element.Tag py:class 1 index.html#tag -
121
119
122
120
These entries can then be referenced in a Sphinx documentation with:
123
121
124
122
.. code-block :: rest
125
123
126
- - :class:`bs4.BeautifulSoup`
127
- - :meth:`bs4.BeautifulSoup.get_text`
128
- - :class:`bs4.element.Tag`
124
+ - :class:`bs4.BeautifulSoup`
125
+ - :meth:`bs4.BeautifulSoup.get_text`
126
+ - :class:`bs4.element.Tag`
129
127
130
128
.. seealso ::
131
129
* `Sphinx objects.inv v2 Syntax
@@ -135,13 +133,13 @@ The error can be corrected with:
135
133
136
134
.. code-block :: console
137
135
138
- $ sphobjinv convert zlib bs4_objects.txt bs4_objects.txt
136
+ $ sphobjinv convert zlib bs4_objects.txt bs4_objects.txt
139
137
140
138
#. Create Sphinx documentation:
141
139
142
140
.. code-block :: console
143
141
144
- $ python -m sphinx -ab html docs/ docs/_build/
142
+ $ python -m sphinx -ab html docs/ docs/_build/
145
143
146
144
Add roles
147
145
---------
@@ -150,18 +148,18 @@ If you get an error message that a certain text role is unknown, e.g.
150
148
151
149
.. code-block :: console
152
150
153
- WARNING: Unknown interpreted text role "confval".
151
+ WARNING: Unknown interpreted text role "confval".
154
152
155
153
so you can add them in the ``conf.py ``:
156
154
157
155
.. code-block :: python
158
156
159
- def setup (app ):
160
- # from sphinx.ext.autodoc import cut_lines
161
- # app.connect('autodoc-process-docstring', cut_lines(4, what=['module']))
162
- app.add_object_type(
163
- " confval" ,
164
- " confval" ,
165
- objname = " configuration value" ,
166
- indextemplate = " pair: %s ; configuration value" ,
167
- )
157
+ def setup (app ):
158
+ # from sphinx.ext.autodoc import cut_lines
159
+ # app.connect('autodoc-process-docstring', cut_lines(4, what=['module']))
160
+ app.add_object_type(
161
+ " confval" ,
162
+ " confval" ,
163
+ objname = " configuration value" ,
164
+ indextemplate = " pair: %s ; configuration value" ,
165
+ )
0 commit comments