Sphinx Note#
Overview#
Sphinx is written in Python and supports Python 3.5+.
Installing Sphinx#
Linux#
RHEL, CentOS
yum install python-sphinx
Installation from PyPI#
pip install -U sphinx
Windows#
pip install -U sphinx
Markdown#
Configuration#
pip install --upgrade recommonmarkextensions = ['recommonmark']source_suffixsource_suffix = { '.rst': 'restructuredtext', '.txt': 'markdown', '.md': 'markdown', }
sphinx-markdown-tables#
pip install sphinx-markdown-tablesconf.pyextensions = [ 'sphinx_markdown_tables', ]
Sphinx Comments#
pip install sphinx-commentsconf.pyextensions = [ 'sphinx_comments', ] comments_config = { "utterances": { "repo": "github-org/github-repo", "optional": "config", } }
Read the Docs#
pip install sphinx_rtd_themesphinx-quickstartSeparate source and build directories (y/n) [n]:
yProject language [en]:
zh_CN
make html
Windows#
make.bat html
Build#
Sign in with GitHub
Import a Project
Sphinx Book Theme#
pip install sphinx-book-themeconf.pyhtml_theme = "sphinx_book_theme" html_theme_options = { "path_to_docs": "doc/source", "repository_url": "https://github.com/T5750/framework-repositories", "repository_branch": "master", "use_source_button": True, "use_edit_page_button": True, "use_issues_button": True, }
Tips#
Read the Docs#
requirements.txtFix
latexmk -r latexmkrc -pdf:*.gifhttps://readthedocs.org/ -> 项目 -> 管理 -> 设置 -> 名称:
frameworksFix
ImportError: cannot import name 'PackageFinder' from 'pip._internal.index':Go to Versions
Click on the Edit button of the version you want to wipe on the right side of the page
Go to the bottom of the page and click the wipe link, next to the “Save” button
Fix
Could not import extension sphinx.builders.linkcheck: use a config file (https://docs.readthedocs.io/en/stable/config-file/v2.html)