|
2 | 2 | import os |
3 | 3 | import sys |
4 | 4 | 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 |
5 | 7 |
|
6 | 8 | extensions = [ |
7 | 9 | "sphinx.ext.autodoc", |
|
27 | 29 | "sphinx_runpython.sphinx_rst_builder", |
28 | 30 | ] |
29 | 31 |
|
| 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 | + |
30 | 41 | templates_path = ["_templates"] |
31 | 42 | html_logo = "_static/logo.png" |
32 | 43 | source_suffix = ".rst" |
|
46 | 57 | html_theme_options = {} |
47 | 58 | html_static_path = ["_static"] |
48 | 59 |
|
| 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 | +] |
49 | 92 |
|
50 | 93 | intersphinx_mapping = { |
51 | 94 | "matplotlib": ("https://matplotlib.org/", None), |
|
0 commit comments