Skip to content

Commit fac56a3

Browse files
authored
Improves documentation conf.py (#19)
* Improves documentation conf.py * conf
1 parent d229036 commit fac56a3

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

_doc/conf.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
import os
33
import sys
44
from sphinx_runpython import __version__
5+
from sphinx_runpython.github_link import make_linkcode_resolve
6+
from sphinx_runpython.conf_helper import has_dvipng, has_dvisvgm
57

68
extensions = [
79
"sphinx.ext.autodoc",
@@ -27,6 +29,15 @@
2729
"sphinx_runpython.sphinx_rst_builder",
2830
]
2931

32+
if has_dvisvgm():
33+
extensions.append("sphinx.ext.imgmath")
34+
imgmath_image_format = "svg"
35+
elif has_dvipng():
36+
extensions.append("sphinx.ext.pngmath")
37+
imgmath_image_format = "png"
38+
else:
39+
extensions.append("sphinx.ext.mathjax")
40+
3041
templates_path = ["_templates"]
3142
html_logo = "_static/logo.png"
3243
source_suffix = ".rst"
@@ -46,6 +57,38 @@
4657
html_theme_options = {}
4758
html_static_path = ["_static"]
4859

60+
html_sourcelink_suffix = ""
61+
62+
# The following is used by sphinx.ext.linkcode to provide links to github
63+
linkcode_resolve = make_linkcode_resolve(
64+
"sphinx-runpython",
65+
(
66+
"https://github.com/sdpython/sphinx-runpython/"
67+
"blob/{revision}/{package}/"
68+
"{path}#L{lineno}"
69+
),
70+
)
71+
72+
latex_elements = {
73+
"papersize": "a4",
74+
"pointsize": "10pt",
75+
"title": project,
76+
}
77+
78+
# Check intersphinx reference targets exist
79+
nitpicky = True
80+
# See also scikit-learn/scikit-learn#26761
81+
nitpick_ignore = [
82+
("py:class", "False"),
83+
("py:class", "True"),
84+
]
85+
86+
nitpick_ignore_regex = [
87+
("py:class", ".*numpy[.].*"),
88+
("py:func", ".*[.]PyCapsule[.].*"),
89+
("py:func", ".*numpy[.].*"),
90+
("py:func", ".*scipy[.].*"),
91+
]
4992

5093
intersphinx_mapping = {
5194
"matplotlib": ("https://matplotlib.org/", None),

0 commit comments

Comments
 (0)