Skip to content

Instantly share code, notes, and snippets.

@Kunkgg
Last active February 19, 2023 12:21
Show Gist options
  • Save Kunkgg/5e9dafc7fbd288821d8b45797dce4a54 to your computer and use it in GitHub Desktop.
Save Kunkgg/5e9dafc7fbd288821d8b45797dce4a54 to your computer and use it in GitHub Desktop.
How to Sphinx

requirements

pip install sphinx

pip install sphinx-rtd-theme
# https://sphinx-themes.org/#themes

sphinx-quickstart

mkdir docs
cd docs
sphinx-quickstart

sphinx-apidoc

sphinx-apidoc -o ./docs .

Note: The sub folders without __init__.py are ignored by sphinx-apidoc.

edit config files

config example

# config.py
import os
import sys

sys.path.insert(0, os.path.abspath('..'))

extensions = [
    'sphinx.ext.autodoc',
    'sphinx.ext.todo',
    'sphinx.ext.viewcode',
]

language = 'zh_CN'

html_theme = 'sphinx_rtd_theme'
# index.rst

modules

make html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment