Skip to content

Commit

Permalink
Merge pull request #26 from BiAPoL/fix-enumeration
Browse files Browse the repository at this point in the history
Used bullet-points instead of numbers to enumerate
  • Loading branch information
haesleinhuepf authored Nov 27, 2021
2 parents 6892daa + c9d97b5 commit e2b6206
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions johannes_mueller/entry_sphinx/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ The `make.bat` allows you to generate html pages from the existing files, which

This looks nice, but as you see, there's nothing on this page yet. Before we find our packages and modules on this page, we have to adjust a few settings in the configuration, which is done by making changes to `conf.py`.

1. First, you'll have to change the directory where Sphinx looks for modules. At the top of `conf.py`, uncomment the following lines and change `sys.path.insert(0, os.path.abspath('.'))` into `sys.path.insert(0, os.path.abspath('../'))`.
* First, you'll have to change the directory where Sphinx looks for modules. At the top of `conf.py`, uncomment the following lines and change `sys.path.insert(0, os.path.abspath('.'))` into `sys.path.insert(0, os.path.abspath('../'))`.

```Python
import os
Expand All @@ -84,15 +84,15 @@ sys.path.insert(0, os.path.abspath('../'))

This tells Sphinx where to look for modules or functions to be documented.

2. Sphinx by itself is not able to parse docstrings of Python functions, but rather relies on extensions that take care of such things. In order to document functions or modules, we need to add the *autodoc* extension to Sphinx:
* Sphinx by itself is not able to parse docstrings of Python functions, but rather relies on extensions that take care of such things. In order to document functions or modules, we need to add the *autodoc* extension to Sphinx:

```Python
extensions = [
'sphinx.ext.autodoc', # Parses docstrings
]
```

3. We now need to tell Sphinx, that the docstrings of our modules, submodules and functions should actually be added to the generated documentation pages. For this, we need to make a few changes to `index.rst`, which currently looks like this:
* We now need to tell Sphinx, that the docstrings of our modules, submodules and functions should actually be added to the generated documentation pages. For this, we need to make a few changes to `index.rst`, which currently looks like this:

```
.. Very good package documentation master file, created by
Expand All @@ -119,7 +119,7 @@ Indices and tables

*Note*: This looks very familiar to the html index page from above, and `index.rst` is, in fact, its blueprint. These *.rst* files (so-called "stubs") are used to tell Sphinx what should be documented. These stubs can be partly autogenerated but can and should partly be edited manually. These stub files can be used to fill html pages with documentation elements by adding so-callled *directives*. Directives in Sphinx are usually introduced with the `.. directive` syntax. For instance, in the above-example of `index.rst`, the table-of-contents directive (`.. toctree::`) is added with the options `:maxdepth: 2` and `:caption: Contents:`, but no entries have been added to this table of contents.

4. In order to add module `submodule_a` from our example repository to the documentation pages, add the automodule extension as a directive to `index.rst`. By setting the option `:imported-memmbers:`, we tell Sphinx to also document all the functions of `submodule_a`, that have been made public in `__init__.py`:
* In order to add module `submodule_a` from our example repository to the documentation pages, add the automodule extension as a directive to `index.rst`. By setting the option `:imported-memmbers:`, we tell Sphinx to also document all the functions of `submodule_a`, that have been made public in `__init__.py`:

```
Welcome to Very good package's documentation!
Expand All @@ -137,7 +137,7 @@ Indices and tables
* :ref:`search`
```

5. Re-run `make html`. If you open `index.html` again, the result will now look much closer to something like an actual documentation!
* Re-run `make html`. If you open `index.html` again, the result will now look much closer to something like an actual documentation!

![screenshot_2](images/screenshot_2.JPG)

Expand Down

0 comments on commit e2b6206

Please sign in to comment.