Skip to content

Commit f2a52b4

Browse files
authored
docs: exectutable update (#262)
Signed-off-by: Henry Schreiner <[email protected]>
1 parent d917b29 commit f2a52b4

File tree

1 file changed

+47
-3
lines changed

1 file changed

+47
-3
lines changed

docs/pages/guides/docs.md

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,27 @@ parent: Topical Guides
1212

1313
Documentation used to require learning RestructureText (sometimes referred to as
1414
ReST / RST), but today we have great choices for documentation in markdown, the
15-
same format used by GitHub, Wikipedia, and others. There are two two major
16-
documentation toolchains, sphinx and mkdocs. This guide covers Sphinx, and uses
17-
the modern MyST plugin to get markdown support.
15+
same format used by GitHub, Wikipedia, and others. This guide covers Sphinx, and
16+
uses the modern MyST plugin to get markdown support.
17+
18+
{: .note-title }
19+
20+
> Other frameworks
21+
>
22+
> There are other frameworks as well; these often are simpler, but are not as
23+
> commonly used, and have somewhat fewer examples and plugins. They are:
24+
>
25+
> - [JupyterBook](): A powerful system for rendering a collection of notebooks
26+
> using Sphinx internally. Can also be used for docs, though, see
27+
> [echopype](https://echopype.readthedocs.io).
28+
> - [MkDocs](): a from-scratch new documentation system based on markdown and
29+
> HTML. Less support for man pages & pdfs than Sphinx, since it doesn't use
30+
> docutils. Has over [200 plugins](https://github.com/mkdocs/catalog) - they
31+
> are much easier to write than Sphinx. Examples include
32+
> [hatch](https://hatch.pypa.io), [PDM](https://pdm.fming.dev),
33+
> [cibuildwheel](https://cibuildwheel.readthedocs.io),
34+
> [Textual](https://textual.textualize.io), and
35+
> [Pipx](https://pypa.github.io/pipx/).
1836
1937
## What to include
2038

@@ -376,6 +394,32 @@ api/<package-name-here>
376394

377395
Note that your docstrings are still parsed as Restructured Text.
378396

397+
## Notebooks in docs
398+
399+
You can combine notebooks into your docs. The tool for this is `nbsphinx`. If
400+
you want to use it, add `nbsphinx` to your documentation requirements, add
401+
`"nbsphinx"` to your `conf.py`'s `extensions =` list, and add some options for
402+
nbsphinx in `conf.py`:
403+
404+
```python
405+
nbsphinx_execute = "auto"
406+
407+
nbsphinx_execute_arguments = [
408+
"--InlineBackend.figure_formats={'png2x'}",
409+
"--InlineBackend.rc=figure.dpi=96",
410+
]
411+
412+
nbsphinx_kernel_name = "python3"
413+
```
414+
415+
You can set `nbsphinx_execute` to `always`, `never`, or `auto` - `auto` will
416+
only execute empty notebooks. The execute arguments shown above will produce
417+
"retina" images from matplotlib. You can set the kernel name (make sure you can
418+
execute all of your (unexecuted) notebooks).
419+
420+
If you want to use markdown instead of notebooks, you can use jupytext (see
421+
[here](https://nbsphinx.readthedocs.io/en/0.9.2/a-markdown-file.html)).
422+
379423
<!-- prettier-ignore-start -->
380424
[diátaxis]: https://diataxis.fr/
381425
[sphinx]: https://www.sphinx-doc.org/

0 commit comments

Comments
 (0)