Install

# install python first
pip install sphinx
pip install sphinx-autobuild
pip install sphinx_rtd_theme
pip install sphinxcontrib-napoleon # theme

Folder structure

|-- project
    |-- custom_lib # python package
    |-- custom_lib-doc
        |-- source
            |-- conf.py
# conf.py
import os, sys
import sphinx_rtd_theme
import sphinxcontrib

path_custom_lib = os.path.abspath('../../')
sys.path.append(path_custom_lib)

project = 'My notes'
copyright = '2020, Math2IT'
author = 'Anh-Thi DINH'
release = '0.2'

extensions = [
    'sphinxcontrib.napoleon',
    'sphinx_rtd_theme',
    'sphinx.ext.mathjax'
]

napoleon_include_init_with_doc = True
napoleon_google_docstring = True
napoleon_use_param = True
napoleon_use_ivar = True

html_theme = 'sphinx_rtd_theme'

html_theme_options = {
    'display_version': True,
    'prev_next_buttons_location': 'both',
    'style_external_links': True,
    'style_nav_header_background': '#F5A603',
    'sticky_navigation': True,
    'navigation_depth': 4,
}

Build

# folder structure
|-- project
    |-- custom_lib
    |-- custom_lib-doc
        |-- source
            |-- conf.py
# build
sphinx-build source build
# auto build + watch the change
sphinx-autobuild source _local -p 8555
# http://127.0.0.1:8555/

Format

Cross url (in the same document)[ref]

# place to ref
:ref:`custum text<CSVLoader>`.

# Display "CSV"
:ref:`CSVLoader`
# somewhere
.. _CSVLoader:

CSV
===
# if heading inside the same file as the caller
Call to `Name of heading`_

Name of heading
===============

External urls:

External hyperlinks, like Python_.

.. _Python: http://www.python.org/
External hyperlinks, like `About Python`_.

.. _About Python: http://www.python.org/

Alert boxes

# note
.. note:: First paragraph.

    Second paragraph.
# warning
.. warning:: Content of the warning.

Insert images

# block
.. image:: images/ball1.gif
# inline
The |biohazard| symbol.

.. |biohazard| image:: biohazard.png

Autodoc from python library

# folder structure
|-- project
    |-- custom_lib
    |-- custom_lib-doc
        |-- source
            |-- conf.py
# conf.py
import os
import sys

path_custom_lib = os.path.abspath('../../')
sys.path.append(path_custom_lib)
# all classes in classes.py
.. automodule:: custom_lib.folder.classes
   :members:
# a specific class in classes.py
.. autoclass:: custom_lib.folder.classes.ClassA
   :members:

References

Notes with this notation aren't good enough. They are being updated. If you can see this, you are so smart. ;)