From ee2433a43120fadde96368366f5b8437af1b9e39 Mon Sep 17 00:00:00 2001 From: BuildingAtom <84liadam@gmail.com> Date: Tue, 13 Feb 2024 16:31:06 -0500 Subject: [PATCH] change theme and fix some css issues --- docs/requirements.txt | 3 ++- docs/source/_static/css/custom.css | 25 +++++++++++++++++++++++++ docs/source/conf.py | 29 +++++++++++++++++++++++++---- 3 files changed, 52 insertions(+), 5 deletions(-) create mode 100644 docs/source/_static/css/custom.css diff --git a/docs/requirements.txt b/docs/requirements.txt index cbfd96f..62d6250 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1,7 +1,8 @@ sphinx==7.1.2 # Theme # furo==2024.1.29 -pydata-sphinx-theme==0.15.2 +# pydata-sphinx-theme==0.15.2 +sphinx-book-theme==1.1.1 # Extensions sphinxcontrib.katex==0.9.9 matplotlib==3.8.2 diff --git a/docs/source/_static/css/custom.css b/docs/source/_static/css/custom.css new file mode 100644 index 0000000..5363ea8 --- /dev/null +++ b/docs/source/_static/css/custom.css @@ -0,0 +1,25 @@ +/* force a centered display math */ +span.katex-display { + width: 100%; +} + +/* fix the version dropdown button */ +.version-switcher__button { + margin-bottom: unset !important; +} + +/* fix dropdown menu position */ +.bd-header-article .dropdown-menu { + position: absolute; + inset: 0px auto auto 0px; + margin: 0px; + transform: translate3d(0px, 28px, 0px); +} + +/* fix dropdown menu hover */ +.bd-header-article .dropdown-source-buttons:hover + .btn + .dropdown-menu { + display: block; +} +.bd-header-article .btn { + display: block; +} diff --git a/docs/source/conf.py b/docs/source/conf.py index 0282b7e..f495089 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -18,13 +18,18 @@ "sphinxcontrib.katex", "sphinx.ext.autosectionlabel", "sphinx_copybutton", - "sphinx_design", "myst_parser", + "sphinx_design", ] myst_enable_extensions = [ "colon_fence", + "deflist", + "substitution", + "html_image", ] +sd_fontawesome_latex = True + katex_prerender = True templates_path = ['_templates'] @@ -36,8 +41,8 @@ # -- Options for HTML output ------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output -html_theme = 'pydata_sphinx_theme' -# html_static_path = ['_static'] +html_theme = 'sphinx_book_theme' +html_static_path = ['_static'] # -- Project information ----------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information @@ -69,9 +74,25 @@ json_url = "https://roahmlab.github.io/zonopy/versions.json" html_theme_options = { + "path_to_docs": version_match, + "repository_url": "https://github.com/roahmlab/zonopy", + "repository_branch": "gh-pages", + "use_repository_button": True, "switcher": { "json_url": json_url, "version_match": version_match, }, - "navbar_center": ["version-switcher", "navbar-nav"], + "article_header_end": ["version-switcher", "article-header-buttons"], +} + +html_css_files = [ + "css/custom.css", +] + +# Example configuration for intersphinx: refer to the Python standard library. +intersphinx_mapping = { + "python": ("https://docs.python.org/3", None), + "numpy": ("https://numpy.org/doc/stable", None), + "torch": ('https://pytorch.org/docs/master/', None), } +