Skip to content

Commit b6fe1c8

Browse files
frankiermmesiti
andcommitted
Apply suggestions from code review
Co-authored-by: Michele Mesiti <mmesiti@users.noreply.github.com>
1 parent ac45248 commit b6fe1c8

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

content/sphinx.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ def multiply(a: float, b: float) -> float:
346346
return a * b
347347
```
348348
349-
2. In the file `conf.py` modify "extensions" and add the `autodoc2_packages` with `"multiply.py"`:
349+
2. In the file `conf.py` add `autodoc2` to the "extensions", and add the list `autodoc2_packages` which will mention `"multiply.py"`:
350350
```python
351351
extensions = ['myst_parser', "autodoc2"]
352352
@@ -374,7 +374,7 @@ If you already have extensions from another exercise, just add `"autodoc2"` to t
374374

375375
`````{exercise} Sphinx-4: Writing Sphinx content with Jupyter
376376
377-
1. Create a text-based notebook files `flower.md` in the same directory as the `index.rst` file. This file will be converted to a Jupyter notebook by the `myst_nb` Sphinx extension and then executed by Jupyter. Fill the file with the following content:
377+
1. For simplicity, create a text-based notebook files `flower.md` in the same directory as the `index.rst` file. This file will be converted to a Jupyter notebook by the `myst_nb` Sphinx extension and then executed by Jupyter. Fill the file with the following content:
378378
````md
379379
---
380380
file_format: mystnb
@@ -396,8 +396,8 @@ ax.plot(theta, r);
396396
ax.plot(theta, np.full(len(theta), -1));
397397
```
398398
````
399-
400-
2. In the file `conf.py` modify `extensions` to remove `"myst_parser"` and add `"myst_nb"` (you will get an error if you include both):
399+
Note that there needs to be a title in the notebook (a heading starting with a single `#`), that will be used as an entry and link in the table of content.
400+
2. In the file `conf.py` modify `extensions` to remove `"myst_parser"` and add `"myst_nb"` ([you will get an error if you include both](https://myst-nb.readthedocs.io/en/latest/quickstart.html)):
401401
```python
402402
extensions = ["myst_nb"]
403403
```
@@ -415,7 +415,9 @@ Note that MyST parser functionality is included in MyST NB, so everything else w
415415
416416
4. Re-build the documentation and check the "Flower" section.
417417
418-
5. (Optional) As an alternative to including a text-based notebook with an `.md` file in your documentation, you can add a `.ipynb` files saved from Jupyter notebook or Jupyter lab. Just make sure to 1) start the notebook with a markdown cell with a `# Title` so it can be included in the table of contents 2) save the notebook in the same directory as `index.rst` and 3) list it in the toctree in `index.rst`.
418+
5. You can add a `.ipynb` files saved from Jupyter notebook or Jupyter lab. Just make sure to list it in the toctree in `index.rst` with the correct path.
419+
420+
If you have problems, consider cleaning manually the `jupyter_execute` directory.
419421
420422
`````
421423

0 commit comments

Comments
 (0)