|
13 | 13 | import os |
14 | 14 | import sys |
15 | 15 |
|
16 | | -sys.path.insert(0, os.path.abspath("../../.")) |
17 | | - |
18 | | -import recommonmark |
19 | | -from recommonmark.transform import AutoStructify |
| 16 | +import sphinx |
20 | 17 | from recommonmark.parser import CommonMarkParser |
21 | 18 |
|
| 19 | +sys.path.insert(0, os.path.abspath("../../.")) |
| 20 | + |
22 | 21 |
|
23 | 22 | # -- Project information ----------------------------------------------------- |
24 | 23 |
|
|
36 | 35 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom |
37 | 36 | # ones. |
38 | 37 | extensions = [ |
| 38 | + "sphinx_rtd_theme", |
39 | 39 | "recommonmark", |
40 | 40 | "nbsphinx", |
41 | 41 | "sphinx.ext.autodoc", |
42 | 42 | "sphinx.ext.coverage", |
43 | 43 | "sphinx.ext.napoleon", |
| 44 | + "sphinx.ext.viewcode", |
44 | 45 | ] |
45 | 46 |
|
46 | 47 | # Add any paths that contain templates here, relative to this directory. |
|
57 | 58 | # The theme to use for HTML and HTML Help pages. See the documentation for |
58 | 59 | # a list of builtin themes. |
59 | 60 | # |
60 | | -html_theme = "alabaster" |
| 61 | +html_theme = "sphinx_rtd_theme" |
61 | 62 |
|
62 | 63 | # Add any paths that contain custom static files (such as style sheets) here, |
63 | 64 | # relative to this directory. They are copied after the builtin static files, |
|
67 | 68 | source_parsers = {".md": CommonMarkParser} |
68 | 69 | source_suffix = [".rst", ".md"] |
69 | 70 |
|
70 | | -def setup(app): |
71 | | - app.add_config_value('recommonmark_config', { |
72 | | - 'enable_math': True, |
73 | | - 'enable_eval_rst': True, |
74 | | - 'auto_code_block': True, |
75 | | - }, True) |
76 | | - app.add_transform(AutoStructify) |
| 71 | +nbsphinx_allow_errors = True |
| 72 | +html_show_sourcelink = False |
| 73 | + |
| 74 | +# certain references in the README couldn't be autoresolved here, |
| 75 | +# hack by forcing to the either the correct documentation page (examples) |
| 76 | +# or to a blob on the repo |
| 77 | +_REPO = "https://github.com/NVIDIA/NVTabular/blob/master/" |
| 78 | +_URL_MAP = { |
| 79 | + "./examples": "examples/index", |
| 80 | + "examples/rossmann-store-sales-example.ipynb": "examples/rossmann", |
| 81 | + "examples/criteo-example.ipynb": "examples/criteo", |
| 82 | + "./CONTRIBUTING": _REPO + "/CONTRIBUTING.md", |
| 83 | + "./Operators": _REPO + "/Operators.md", |
| 84 | +} |
| 85 | + |
| 86 | + |
| 87 | +class GitHubDomain(sphinx.domains.Domain): |
| 88 | + def resolve_any_xref(self, env, docname, builder, target, node, contnode): |
| 89 | + resolved = _URL_MAP.get(target) |
| 90 | + print("resolver", target, resolved) |
| 91 | + if resolved: |
| 92 | + contnode["refuri"] = resolved |
| 93 | + return [("github:any", contnode)] |
| 94 | + return [] |
77 | 95 |
|
78 | 96 |
|
79 | | -nbsphinx_allow_errors = True |
| 97 | +def setup(app): |
| 98 | + app.add_domain(GitHubDomain) |
0 commit comments