Skip to content

Commit adc057b

Browse files
danirusjonathanslenders
authored andcommitted
Use sphinx-nefertiti theme for the docs
1 parent 2e985c2 commit adc057b

File tree

2 files changed

+41
-17
lines changed

2 files changed

+41
-17
lines changed

docs/conf.py

Lines changed: 39 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
# All configuration values have a default; values that are commented out
1212
# serve to show the default.
1313

14-
import os
1514

1615
# If extensions (or modules to document with autodoc) are in another directory,
1716
# add these directories to sys.path here. If the directory is relative to the
@@ -26,7 +25,7 @@
2625
# Add any Sphinx extension module names here, as strings. They can be
2726
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
2827
# ones.
29-
extensions = ["sphinx.ext.autodoc", "sphinx.ext.graphviz"]
28+
extensions = ["sphinx.ext.autodoc", "sphinx.ext.graphviz", "sphinx_copybutton"]
3029

3130
# Add any paths that contain templates here, relative to this directory.
3231
# templates_path = ["_templates"]
@@ -42,7 +41,7 @@
4241

4342
# General information about the project.
4443
project = "prompt_toolkit"
45-
copyright = "2014-2020, Jonathan Slenders"
44+
copyright = "2014-2023, Jonathan Slenders"
4645

4746
# The version info for the project you're documenting, acts as replacement for
4847
# |version| and |release|, also used in various other places throughout the
@@ -83,7 +82,8 @@
8382
# show_authors = False
8483

8584
# The name of the Pygments (syntax highlighting) style to use.
86-
pygments_style = "sphinx"
85+
pygments_style = "pastie"
86+
pygments_dark_style = "dracula"
8787

8888
# A list of ignored prefixes for module index sorting.
8989
# modindex_common_prefix = []
@@ -105,23 +105,46 @@
105105
# The theme to use for HTML and HTML Help pages. See the documentation for
106106
# a list of builtin themes.
107107

108-
on_rtd = os.environ.get("READTHEDOCS", None) == "True"
108+
# on_rtd = os.environ.get("READTHEDOCS", None) == "True"
109+
110+
try:
111+
import sphinx_nefertiti
112+
113+
html_theme = "sphinx_nefertiti"
114+
html_theme_path = [sphinx_nefertiti.get_html_theme_path()]
115+
html_theme_options = {
116+
# "style" can take the following values: "blue", "indigo", "purple",
117+
# "pink", "red", "orange", "yellow", "green", "tail", and "default".
118+
"style": "default",
119+
# Fonts are customizable (and are not retrieved online).
120+
# https://sphinx-nefertiti.readthedocs.io/en/latest/users-guide/customization/fonts.html
121+
# "documentation_font": "Open Sans",
122+
# "monospace_font": "Ubuntu Mono",
123+
# "monospace_font_size": "1.1rem",
124+
"logo": "logo_400px.png",
125+
"logo_alt": "python-prompt-toolkit",
126+
"logo_width": "36",
127+
"logo_height": "36",
128+
"repository_url": "https://github.com/prompt-toolkit/python-prompt-toolkit",
129+
"repository_name": "python-prompt-toolkit",
130+
"footer_links": ",".join(
131+
[
132+
"Documentation|https://python-prompt-toolkit.readthedocs.io/",
133+
"Package|https://pypi.org/project/prompt-toolkit/",
134+
"Repository|https://github.com/prompt-toolkit/python-prompt-toolkit",
135+
"Issues|https://github.com/prompt-toolkit/python-prompt-toolkit/issues",
136+
]
137+
),
138+
}
139+
140+
except ImportError:
141+
html_theme = "pyramid"
109142

110-
if on_rtd:
111-
html_theme = "default"
112-
else:
113-
try:
114-
import sphinx_rtd_theme
115-
116-
html_theme = "sphinx_rtd_theme"
117-
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
118-
except ImportError:
119-
html_theme = "pyramid"
120143

121144
# Theme options are theme-specific and customize the look and feel of a theme
122145
# further. For a list of options available for each theme, see the
123146
# documentation.
124-
# html_theme_options = {}
147+
125148

126149
# Add any paths that contain custom themes here, relative to this directory.
127150
# html_theme_path = []

docs/requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
Sphinx<7
22
wcwidth<1
33
pyperclip<2
4-
sphinx_rtd_theme<2
4+
sphinx_copybutton>=0.5.0,<1.0.0
5+
sphinx-nefertiti>=0.2.1

0 commit comments

Comments
 (0)