Welcome to SphinxTest’s documentation!¶
The index.rst file¶
This file is located within the docs root and creates the table of contents (TOC) for displaying next to the page.
While not mandatory, this helps with navigation quite a bit.
Unfortunately, the index.rst is much more difficult to automate as it is the basic source file of Sphinx.
If a new modules is created, its path needs to be written down in the index.rst file for it to show up in the TOC.
Getting Started with this test¶
Sphinx is made with reStructured text. It is a bit different than markdown.
- This is some wild stuff right here.
- directives use “:”
- it is quite annoying to get used to
Some math¶
That was some math. I bet it looks cool. Every tool I have for previewing this sucks.
Using markdown¶
Markdown may be used at the cost of some advanced functionalities
Blog post of some nerd ranting about it
Main points:
Markdown has no set standard
- There are a million interpreters with millions of syntax
Harder to expand
- May rely on CSS stuff
- Breaks portability for other tools
Basically,
reStructured text is awful to write but is more stable and standard for documentation
Docstring Format¶
Back in the day, docstrings used to be just plain reStructuredText inside of docstrings.
- It was very gross.
- For everyone.
Solution¶
Numpy Project and Google defined a non-gross docstring formats that everyone accepts and Sphinx recognizes.
- Sphinx needs an addon called “Napoleon” to interpret them.
- It is not a problem. This is defined in the doc’s conf.py.
conf.py:
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.todo',
'sphinx.ext.coverage',
'sphinx.ext.mathjax',
'sphinx.ext.ifconfig',
'sphinx.ext.viewcode',
'sphinx.ext.githubpages',
'sphinx.ext.napoleon', # <- Here is Napoleon
]
See also: Google docstrings Example
The code in sphinxtest.alpha
and sphinxtest.beta
utilize this Docstring format and are automatically generated.