|
48 | 48 | extensions = [ |
49 | 49 | "sphinx.ext.mathjax", |
50 | 50 | "sphinx.ext.napoleon", |
51 | | - "myst_parser", |
52 | | - "IPython.sphinxext.ipython_directive", |
| 51 | + # myst_nb is a superset of myst_parser: it provides the MyST markdown |
| 52 | + # parser plus executable `{code-cell}` notebook directives. Do NOT also |
| 53 | + # list "myst_parser" — myst_nb activates it internally and listing both |
| 54 | + # raises an extension conflict. |
| 55 | + "myst_nb", |
53 | 56 | "autoapi.extension", |
54 | 57 | ] |
55 | 58 |
|
56 | 59 | # NOTE: .rst stays alongside .md because sphinx-autoapi generates RST |
57 | 60 | # under autoapi/ and Sphinx needs the suffix to parse it. The human- |
58 | | -# authored docs are all MyST .md now; the .rst entry is only for the |
59 | | -# autoapi build artifacts. |
| 61 | +# authored docs are all MyST .md now. ".md" is routed through myst-nb so |
| 62 | +# pages carrying jupytext/kernelspec front matter execute their |
| 63 | +# `{code-cell}` blocks; pages without that front matter render as plain |
| 64 | +# MyST markdown. The ".rst" entry is only for the autoapi build artifacts. |
60 | 65 | source_suffix = { |
61 | 66 | ".rst": "restructuredtext", |
62 | | - ".md": "markdown", |
| 67 | + ".md": "myst-nb", |
63 | 68 | } |
64 | 69 |
|
| 70 | +# Execute notebook code cells at build time and fail the build if any cell |
| 71 | +# raises — this replaces the old IPython sphinx directive, whose executed |
| 72 | +# examples are now `{code-cell}` blocks. "force" re-executes every build so |
| 73 | +# stale cached output can never ship. |
| 74 | +nb_execution_mode = "force" |
| 75 | +nb_execution_timeout = 120 |
| 76 | +nb_execution_raise_on_error = True |
| 77 | + |
65 | 78 | # Add any paths that contain templates here, relative to this directory. |
66 | 79 | templates_path = ["_templates"] |
67 | 80 |
|
|
0 commit comments