From 38dcd06dfab4ef60a1f3c5368a6b595d4fb895c1 Mon Sep 17 00:00:00 2001 From: Revathy Venugopal <104772255+Revathyvenugopal162@users.noreply.github.com> Date: Mon, 7 Nov 2022 11:40:30 +0100 Subject: [PATCH] Maintain edit this button style and version switcher (#143) * Add edit button * Add requirement sort pre-commit * Add styles for version switch hovering * Update doc/source/conf.py Co-authored-by: Roberto Pastor Muela Co-authored-by: Roberto Pastor Muela --- .pre-commit-config.yaml | 1 + doc/source/conf.py | 8 ++++++++ requirements/requirements_doc.txt | 2 +- src/ansys_sphinx_theme/static/404.rst | 5 ++--- .../static/css/ansys_sphinx_theme.css | 10 ++++++++++ 5 files changed, 22 insertions(+), 4 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6e3675c7..23806b7f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -30,6 +30,7 @@ repos: hooks: - id: check-merge-conflict - id: debug-statements + - id: requirements-txt-fixer # this validates our github workflow files - repo: https://github.com/python-jsonschema/check-jsonschema diff --git a/doc/source/conf.py b/doc/source/conf.py index 6a61257a..0db510a7 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -26,9 +26,17 @@ html_logo = ansys_logo_black html_theme = "ansys_sphinx_theme" +html_context = { + "github_user": "ansys", + "github_repo": "ansys-sphinx-theme", + "github_version": "main", + "doc_path": "doc/source", +} + # specify the location of your github repo html_theme_options = { "github_url": "https://github.com/ansys/ansys-sphinx-theme", + "use_edit_page_button": True, "contact_mail": "pyansys.support@ansys.com", "additional_breadcrumbs": [ ("Ansys Internal Developer Portal", "https://dev.docs.ansys.com"), diff --git a/requirements/requirements_doc.txt b/requirements/requirements_doc.txt index 74bb4376..967fd116 100644 --- a/requirements/requirements_doc.txt +++ b/requirements/requirements_doc.txt @@ -1,4 +1,4 @@ -Sphinx==5.3.0 numpydoc==1.5.0 +Sphinx==5.3.0 sphinx-copybutton==0.5.0 sphinx-notfound-page==0.8.3 diff --git a/src/ansys_sphinx_theme/static/404.rst b/src/ansys_sphinx_theme/static/404.rst index 1dfd77be..c5599198 100644 --- a/src/ansys_sphinx_theme/static/404.rst +++ b/src/ansys_sphinx_theme/static/404.rst @@ -1,7 +1,6 @@ -:orphan: - Oops! ===== + This is unexpected. The page you are requesting does not exist. -If this page should exist, please contact `{{ theme_contact_mail }} `_. \ No newline at end of file diff --git a/src/ansys_sphinx_theme/static/css/ansys_sphinx_theme.css b/src/ansys_sphinx_theme/static/css/ansys_sphinx_theme.css index 42f2cb3b..d692a1d4 100644 --- a/src/ansys_sphinx_theme/static/css/ansys_sphinx_theme.css +++ b/src/ansys_sphinx_theme/static/css/ansys_sphinx_theme.css @@ -799,3 +799,13 @@ html[data-theme="dark"] .highlight pre { #version_switcher_button { background-color: var(--pst-color-background); } + +.editthispage a { + color: var(--pst-color-text-base); +} + +#version_switcher_menu a.list-group-item.active { + background-color: var(--pst-color-background); + border-color: var(--pst-color-border); + color: var(--pst-color-text-base) +} \ No newline at end of file