From adc057b3d9935172cf400e333978cdfbf597763e Mon Sep 17 00:00:00 2001 From: Daniela Rus Morales Date: Wed, 18 Oct 2023 06:36:34 +0200 Subject: [PATCH] Use sphinx-nefertiti theme for the docs --- docs/conf.py | 55 ++++++++++++++++++++++++++++++------------- docs/requirements.txt | 3 ++- 2 files changed, 41 insertions(+), 17 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 0b015ac46..7afdb7fa2 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -11,7 +11,6 @@ # All configuration values have a default; values that are commented out # serve to show the default. -import os # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the @@ -26,7 +25,7 @@ # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. -extensions = ["sphinx.ext.autodoc", "sphinx.ext.graphviz"] +extensions = ["sphinx.ext.autodoc", "sphinx.ext.graphviz", "sphinx_copybutton"] # Add any paths that contain templates here, relative to this directory. # templates_path = ["_templates"] @@ -42,7 +41,7 @@ # General information about the project. project = "prompt_toolkit" -copyright = "2014-2020, Jonathan Slenders" +copyright = "2014-2023, Jonathan Slenders" # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -83,7 +82,8 @@ # show_authors = False # The name of the Pygments (syntax highlighting) style to use. -pygments_style = "sphinx" +pygments_style = "pastie" +pygments_dark_style = "dracula" # A list of ignored prefixes for module index sorting. # modindex_common_prefix = [] @@ -105,23 +105,46 @@ # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -on_rtd = os.environ.get("READTHEDOCS", None) == "True" +# on_rtd = os.environ.get("READTHEDOCS", None) == "True" + +try: + import sphinx_nefertiti + + html_theme = "sphinx_nefertiti" + html_theme_path = [sphinx_nefertiti.get_html_theme_path()] + html_theme_options = { + # "style" can take the following values: "blue", "indigo", "purple", + # "pink", "red", "orange", "yellow", "green", "tail", and "default". + "style": "default", + # Fonts are customizable (and are not retrieved online). + # https://sphinx-nefertiti.readthedocs.io/en/latest/users-guide/customization/fonts.html + # "documentation_font": "Open Sans", + # "monospace_font": "Ubuntu Mono", + # "monospace_font_size": "1.1rem", + "logo": "logo_400px.png", + "logo_alt": "python-prompt-toolkit", + "logo_width": "36", + "logo_height": "36", + "repository_url": "https://github.com/prompt-toolkit/python-prompt-toolkit", + "repository_name": "python-prompt-toolkit", + "footer_links": ",".join( + [ + "Documentation|https://python-prompt-toolkit.readthedocs.io/", + "Package|https://pypi.org/project/prompt-toolkit/", + "Repository|https://github.com/prompt-toolkit/python-prompt-toolkit", + "Issues|https://github.com/prompt-toolkit/python-prompt-toolkit/issues", + ] + ), + } + +except ImportError: + html_theme = "pyramid" -if on_rtd: - html_theme = "default" -else: - try: - import sphinx_rtd_theme - - html_theme = "sphinx_rtd_theme" - html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] - except ImportError: - html_theme = "pyramid" # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. -# html_theme_options = {} + # Add any paths that contain custom themes here, relative to this directory. # html_theme_path = [] diff --git a/docs/requirements.txt b/docs/requirements.txt index 8ec7a74ab..beb1c314b 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,4 +1,5 @@ Sphinx<7 wcwidth<1 pyperclip<2 -sphinx_rtd_theme<2 +sphinx_copybutton>=0.5.0,<1.0.0 +sphinx-nefertiti>=0.2.1