diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b1176c28..db14d990 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -43,3 +43,10 @@ repos: rev: 0.21.0 hooks: - id: check-github-workflows + + +- repo: https://github.com/adamchainz/blacken-docs + rev: 1.15.0 + hooks: + - id: blacken-docs + additional_dependencies: [black==23.7.0] diff --git a/doc/source/conf.py b/doc/source/conf.py index 61cf3012..021c9048 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -47,6 +47,7 @@ "doc_path": "doc/source", } + # specify the location of your github repo html_theme_options = { "github_url": "https://github.com/ansys/ansys-sphinx-theme", @@ -67,8 +68,7 @@ "use_meilisearch": { "api_key": os.getenv("MEILISEARCH_API_KEY", ""), "index_uids": { - "ansys-ansys-sphinx-theme-sphinx-docs": "ansys-sphinx-theme", - "ansys-pyaedt-sphinx-docs": "PyAEDT", + f"ansys-sphinx-theme-v{get_version_match(__version__)}": "ansys-sphinx-theme", }, }, } diff --git a/doc/source/getting_started/index.rst b/doc/source/getting_started/index.rst index 22187f45..db976bbe 100644 --- a/doc/source/getting_started/index.rst +++ b/doc/source/getting_started/index.rst @@ -22,7 +22,7 @@ Modify the ``conf.py`` file --------------------------- To use this theme, modify your Sphinx ``conf.py`` file:: - html_theme ='ansys_sphinx_theme' + html_theme = "ansys_sphinx_theme" Consider using the ``conf.py`` for this repository: diff --git a/doc/source/user_guide/404_page.rst b/doc/source/user_guide/404_page.rst index 169c6789..6ba9ddca 100644 --- a/doc/source/user_guide/404_page.rst +++ b/doc/source/user_guide/404_page.rst @@ -43,7 +43,7 @@ Use the default 404 page To use the default 404 page, you can use the ``generate_404`` function in the ``ansys_sphinx_theme`` module to create and use a custom cover page: -.. code-block:: python +.. code-block:: pycon from ansys_sphinx_theme import generate_404 diff --git a/doc/source/user_guide/css.rst b/doc/source/user_guide/css.rst index 5537155b..3e9704b1 100644 --- a/doc/source/user_guide/css.rst +++ b/doc/source/user_guide/css.rst @@ -32,6 +32,6 @@ Next, in your ``conf.py`` file, add the following: .. code:: python - html_static_path = ['_static'] - html_css_files = ['css/custom.css'] + html_static_path = ["_static"] + html_css_files = ["css/custom.css"] diff --git a/doc/source/user_guide/options.rst b/doc/source/user_guide/options.rst index bf0c44f2..0760fb0b 100644 --- a/doc/source/user_guide/options.rst +++ b/doc/source/user_guide/options.rst @@ -39,14 +39,14 @@ to the same value as the title for the main ``index.rst`` page: .. code:: python - html_short_title = html_title = 'Ansys Sphinx Theme' + html_short_title = html_title = "Ansys Sphinx Theme" If you want to title for the main ``index.rst`` file to show the package version, include ``|version|`` in the title: .. code:: python - html_short_title = html_title = 'Ansys Sphinx Theme |version|' + html_short_title = html_title = "Ansys Sphinx Theme |version|" Customize icons --------------- @@ -72,7 +72,7 @@ the ``icon``, and the ``type``. This example adds an icon for sending an email: -.. code-block:: python +.. code-block:: pycon html_theme_options = { "icon_links": [ @@ -86,7 +86,7 @@ Hide icons To hide icons so that they do not show in the navigation bar, add their names to the ``hidden_icons`` list: -.. code-block:: python +.. code-block:: pycon html_theme_options = { "hidden_icons": ["GitHub"], @@ -96,7 +96,7 @@ to the ``hidden_icons`` list: If you want to hide all icons, use the ``show_icons`` boolean variable: -.. code-block:: python +.. code-block:: pycon html_theme_options = { "show_icons": False, @@ -137,15 +137,15 @@ Here is an example configuration for using MeiliSearch in the ``conf.py`` file: .. code-block:: python - import os + import os use_meilisearch = { "host": os.getenv("MEILISEARCH_HOST_NAME", ""), "api_key": os.getenv("MEILISEARCH_API_KEY", ""), "index_uids": { "index-uid of current project": "index name to be displayed", - "another-index-uid": "index name to be displayed" - } + "another-index-uid": "index name to be displayed", + }, } Here is the example configuration of using MeiliSearch in @@ -153,15 +153,15 @@ Here is the example configuration of using MeiliSearch in .. code-block:: python - import os - + import os + html_theme_options = { - "use_meilisearch": { - "index_uids": { - "ansys-ansys-sphinx-theme-sphinx-docs": "ansys-sphinx-theme", - "pyansys-docs-all-public": "PyAnsys", + "use_meilisearch": { + "index_uids": { + "ansys-sphinx-theme-sphinx-docs": "ansys-sphinx-theme", + "pyansys-docs-all-public": "PyAnsys", + }, }, - }, } With these options set, your Sphinx project can use MeiliSearch diff --git a/doc/source/user_guide/pdf.rst b/doc/source/user_guide/pdf.rst index 8b0c899e..1eae688e 100644 --- a/doc/source/user_guide/pdf.rst +++ b/doc/source/user_guide/pdf.rst @@ -11,7 +11,7 @@ page. However, you can use the ``generate_preamble`` function in the You use this function to generate the value for the ``preamble`` key in the ``latex_elements`` variable declared in the ``conf.py`` file: -.. code-block:: python +.. code-block:: pycon latex_elements = { "preamble": ansys_sphinx_theme.latex.generate_preamble( @@ -27,13 +27,11 @@ import them and then add them to the ``latex_additional_files`` dictionary: .. code-block:: python from ansys_sphinx_theme import ( - ansys_logo_white, - ansys_logo_white_cropped, - watermark, + ansys_logo_white, + ansys_logo_white_cropped, + watermark, ) .. code-block:: python - latex_additional_files = [ - watermark, ansys_logo_white, ansys_logo_white_cropped - ] + latex_additional_files = [watermark, ansys_logo_white, ansys_logo_white_cropped] diff --git a/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/components/search-field.html b/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/components/search-field.html index 4919c931..e21d98d9 100644 --- a/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/components/search-field.html +++ b/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/components/search-field.html @@ -33,6 +33,7 @@ theme_use_meilisearch.host %} {% endif %} {% else %} diff --git a/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/static/css/meilisearch.css b/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/static/css/meilisearch.css index 90479413..4644deca 100644 --- a/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/static/css/meilisearch.css +++ b/src/ansys_sphinx_theme/theme/ansys_sphinx_theme/static/css/meilisearch.css @@ -2,6 +2,7 @@ @import "https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"; div [data-ds-theme] .searchbox { + overflow-y: scroll; margin: auto; display: block; width: 600px; @@ -14,11 +15,11 @@ div [data-ds-theme] .searchbox { .docs-searchbar-suggestion--category-header { background-color: var(--pst-color-border); border-radius: 7px; - text-align: center; + text-align: left; } .docs-searchbar-suggestion--subcategory-column-text { - color: (var(--pst-color-text-base)); + color: var(--pst-color-text-base); } div [data-ds-theme] .searchbox input { @@ -91,23 +92,72 @@ div [data-ds-theme] .searchbox input { .meilisearch-autocomplete .dsb-dropdown-menu [class^="dsb-dataset-"] { position: relative; border: 1px solid #d9d9d9; - background: #fff; + background: var(--pst-color-background); border-radius: 4px; - overflow: auto; + max-width: 800px; + min-width: 500px; padding: 0 8px 8px; width: 805px; } +.meilisearch-autocomplete .dsb-dropdown-menu { + height: 500px !important; /* Set a fixed height to trigger the scrollbar */ + overflow-y: auto !important; /* Enable the vertical scrollbar */ + border: 1px solid #ccc; +} .meilisearch-autocomplete .docs-searchbar-suggestion { width: 735px; + background: var(--pst-color-background); } .meilisearch-autocomplete .docs-searchbar-suggestion--highlight { - color: var(--pst-color-info); - background: rgb(255 255 255 / 49%); + color: var(--pst-color-info) !important; + font-weight: 900; + background: transparent; padding: 0 0.05em; } .meilisearch-autocomplete .docs-searchbar-suggestion--subcategory-column { - width: 30%; + width: None; + text-align: left; +} + +.meilisearch-autocomplete .docs-searchbar-suggestion--content { + display: block; + width: 100% !important; +} + +.meilisearch-autocomplete .dsb-dropdown-menu { + max-width: 800px; +} + +.meilisearch-autocomplete .docs-searchbar-suggestion--title { + margin-bottom: 4px; + color: var(--pst-color-text-base); + font-size: 0.9em; + font-weight: 700; + width: 100%; +} + +.meilisearch-autocomplete .docs-searchbar-suggestion--text { + width: 100%; +} + +/* Styling the scrollbar */ +.meilisearch-autocomplete .dsb-dropdown-menu::-webkit-scrollbar { + width: 0.5rem; + height: 0.5rem; +} + +.meilisearch-autocomplete .dsb-dropdown-menu::-webkit-scrollbar-thumb { + background: var(--pst-color-text-base); + border-radius: inherit; +} + +.meilisearch-autocomplete .dsb-dropdown-menu::-webkit-scrollbar-track { + background: var(--pst-color-background); +} + +.bd-search { + margin-bottom: 200px; }