Skip to content

Commit 1919b75

Browse files
committed
feat(docs.conf): Update sphinx configuration to use and setup custom lexer. Toggle autosummary and napoleon extensions.
1 parent 69b5cb4 commit 1919b75

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

docs/source/conf.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@
3232
import os
3333
import sys
3434

35+
from sphinx.application import Sphinx
36+
from sphinx.highlighting import lexer_classes
37+
3538

3639
sys.path.insert(0, os.path.abspath("../src/"))
3740
sys.path.append(os.path.abspath("./_ext")) # Required for custom extensions
@@ -51,6 +54,8 @@
5154
"sphinx.ext.autosummary",
5255
"sphinx.ext.napoleon",
5356
]
57+
autosummary_generate = True # Turn on sphinx.ext.autosummary
58+
napoleon_google_docstring = True
5459

5560
templates_path = ["_templates"]
5661
exclude_patterns = []
@@ -63,3 +68,14 @@
6368
html_static_path = ["_static"]
6469
html_css_files = ["custom.css"]
6570
pygments_style = "styles.VSCodeDarkPlus"
71+
72+
73+
def setup(app: Sphinx) -> None:
74+
"""Custom sphinx application startup setup."""
75+
from lexer import CustomPythonLexer
76+
77+
app.add_lexer("python", CustomPythonLexer)
78+
assert "python" in lexer_classes, "python language not found in registry"
79+
assert lexer_classes["python"] == CustomPythonLexer, (
80+
"custom Lexer not found in registry."
81+
)

0 commit comments

Comments
 (0)