Extensions¶
Demonstration¶
Built-in extensions¶
Add to conf.py:
extensions = []
sphinx.ext.extlinks – Markup to shorten external links¶
Add to conf.py:
extlinks = {'issue': ('https://github.com/sphinx-doc/sphinx/issues/%s', 'issue %s')}
sphinx.ext.autodoc – Include documentation from docstrings¶
In conf.py add:
import os
import sys
sys.path.insert(0, os.path.abspath(".."))
# 0 is the beginning
# relative path to docs
sphinx.ext.intersphinx – Link to other projects’ documentation¶
Add to conf.py:
# intersphinx mapping
intersphinx_mapping = {'python': ('https://docs.python.org/3', None)}
sphinx.ext.graphviz – Add Graphviz graphs¶
Install:
scoop install graphviz
dot -c
pip install graphviz


Clickable
![digraph example {
a [label="sphinx", href="https://www.sphinx-doc.org", target="_top"];
b [label="other"];
a -> b;
}](_images/graphviz-3c898f977ba40ac0828a622264748f7a8b576f6c.png)
sphinx.ext.todo – Support for todo items¶
Todo
🟩 Mercury
✅ Venus
Third Party Extensions¶
Text Utility¶
sphinx-copybutton¶
Install:
pip install sphinx-copybutton
Add to conf.py:
extensions = [
...
"sphinx_copybutton",
...
]
Diagram¶
Support Python Code¶
Links References Indices¶
Changing Content Programmatically¶
Maths Support¶
write LaTeX math using $$¶
Install:
pip install sphinx-math-dollar
Edit conf.py:
extensions = ['sphinx_math_dollar', 'sphinx.ext.mathjax']
mathjax_config = {
'tex2jax': {
'inlineMath': [ ["\\(", "\\)"] ],
'displayMath': [["\\[", "\\]"] ],
},
}
Fix:
WARNING: mathjax_config/mathjax2_config does not work for the current MathJax version, use mathjax3_config instead
Issues
Warning
quizdown stops working
Classroom¶
Attention
Consider just use Python’s Quizdown
Install:
pip install git+git://github.com/bonartm/sphinxcontrib-quizdown
Setup:
extensions = [
...,
"sphinxcontrib.quizdown",
...
]