Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 1 addition & 17 deletions docs/user_guide/web-components.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,12 @@
Sphinx Design Components
========================

Cards and tabs provide some extra UI flexibility for your content. Both `sphinx-design <https://sphinx-design.readthedocs.io/en/latest/index.html>`__ and `sphinx-panels <https://sphinx-panels.readthedocs.io/en/latest/>`__ can be used with this theme. This theme provides custom CSS to ensure that their look and feel is consistent with this theme.
Cards and tabs provide some extra UI flexibility for your content. This theme provides custom CSS to ensure that `sphinx-design <https://sphinx-design.readthedocs.io/en/latest/index.html>`__ elements look and feel consistent with this theme.

.. seealso::

For more about how to use these extensions, see `the sphinx-design documentation <https://sphinx-design.readthedocs.io/en/latest/index.html>`_.

.. danger::

``sphinx-panels`` is no longer maintained and we recommend you switch to ``sphinx-design``.
We will deprecate support for sphinx-panels soon.

To use the :code:`sphinx-panels` extention, add these lines to your custom CSS to overwrite the shadows of the panels:

.. code-block:: css

/* overwrite panels shadows using pydata-sphinx-theme variable */
.shadow {
box-shadow: 0 0.5rem 1rem var(--pst-color-shadow) !important;
}

This modification is not needed when using the :code:`sphinx-design` extention.

Below you can find some examples of the components created with the :code:`sphinx-design` extension.

.. _badges-buttons:
Expand Down
37 changes: 3 additions & 34 deletions src/pydata_sphinx_theme/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,7 @@
def update_config(app):
theme_options = app.config.html_theme_options

# DEPRECATE >= v0.10
if theme_options.get("search_bar_position") == "navbar":
logger.warning(
"Deprecated config `search_bar_position` used."
"Use `search-field.html` in `navbar_end` template list instead."
)

# DEPRECATE >= 0.11
if theme_options.get("left_sidebar_end"):
theme_options["primary_sidebar_end"] = theme_options.get("left_sidebar_end")
logger.warning(
"The configuration `left_sidebar_end` is deprecated."
"Use `primary_sidebar_end`"
)

# TODO: deprecation; remove after 0.14 release
if theme_options.get("logo_text"):
logo = theme_options.get("logo", {})
logo["text"] = theme_options.get("logo_text")
Expand All @@ -58,6 +44,7 @@ def update_config(app):
"The configuration `logo_text` is deprecated." "Use `'logo': {'text': }`."
)

# TODO: deprecation; remove after 0.13 release
if theme_options.get("page_sidebar_items"):
theme_options["secondary_sidebar_items"] = theme_options.get(
"page_sidebar_items"
Expand Down Expand Up @@ -86,6 +73,7 @@ def update_config(app):
app.config.values["html_permalinks_icon"] = ("#", *icon_default[1:])

# Raise a warning for a deprecated theme switcher config
# TODO: deprecation; remove after 0.13 release
if "url_template" in theme_options.get("switcher", {}):
logger.warning(
"html_theme_options['switcher']['url_template'] is no longer supported."
Expand Down Expand Up @@ -188,14 +176,6 @@ def prepare_html_config(app, pagename, templatename, context, doctree):
if not isinstance(theme_logo, dict):
raise ValueError(f"Incorrect logo config type: {type(theme_logo)}")

# DEPRECATE: >= 0.11
if context.get("theme_logo_link"):
logger.warning(
"DEPRECATION: Config `logo_link` will be deprecated in v0.11. "
"Use the `logo.link` configuration dictionary instead."
)
theme_logo = context.get("theme_logo_link")

context["theme_logo"] = theme_logo

# update version number
Expand Down Expand Up @@ -415,14 +395,6 @@ def generate_header_nav_html(n_links_before_dropdown=5):

return out

# TODO: Deprecate after v0.12
def generate_nav_html(*args, **kwargs):
logger.warning(
"`generate_nav_html` is deprecated and will be removed."
"Use `generate_toctree_html` instead."
)
generate_toctree_html(*args, **kwargs)

# Cache this function because it is expensive to run, and becaues Sphinx
# somehow runs this twice in some circumstances in unpredictable ways.
@lru_cache(maxsize=None)
Expand Down Expand Up @@ -588,9 +560,6 @@ def navbar_align_class():
context["generate_toc_html"] = generate_toc_html
context["navbar_align_class"] = navbar_align_class

# TODO: Deprecate after v0.12
context["generate_nav_html"] = generate_nav_html


def _add_collapse_checkboxes(soup):
"""Add checkboxes to collapse children in a toctree."""
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@
@import "./extensions/execution";
@import "./extensions/pydata";
@import "./extensions/sphinx_design";
@import "./extensions/sphinx_panels";
@import "./extensions/togglebutton";
@import "./extensions/notebooks";
@import "./extensions/leaflet";
Expand Down
7 changes: 0 additions & 7 deletions src/pydata_sphinx_theme/theme/pydata_sphinx_theme/theme.conf
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,5 @@ footer_end = theme-version.html
secondary_sidebar_items = page-toc.html, edit-this-page.html, sourcelink.html
announcement =

# DEPRECATE after 0.11
logo_text =

# DEPRECATE after 0.12
left_sidebar_end =
page_sidebar_items =

# DEPRECATE after 0.14
footer_items =
2 changes: 1 addition & 1 deletion tests/sites/deprecated/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
# Base options, we can add other key/vals later
html_theme_options = {
"search_bar_position": "navbar",
"left_sidebar_end": ["sidebar-ethical-ads.html"],
"logo_text": "DOCS",
"page_sidebar_items": [
"page-toc.html",
"edit-this-page.html",
"sourcelink.html",
],
"footer_items": ["test.html"],
}

html_sidebars = {"section1/index": ["sidebar-nav-bs.html"]}
14 changes: 12 additions & 2 deletions tests/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -865,8 +865,18 @@ def test_deprecated_build_html(sphinx_build_factory, file_regression):
assert (sphinx_build.outdir / "index.html").exists(), sphinx_build.outdir.glob("*")

# check the deprecation warnings
warnings = sphinx_build.warnings.split("WARNING: ")
assert len(warnings) == 5 # testing the text of the warning is not necessary here
warnings = sphinx_build.warnings.strip("\n").split("\n")
warnings = [w.lstrip("\x1b[91m").rstrip("\x1b[39;49;00m\n") for w in warnings]
expected_warnings = (
"The configuration `logo_text` is deprecated",
"The configuration `page_sidebar_items` is deprecated",
"`footer_items` is deprecated",
"unsupported theme option 'logo_text'",
"unsupported theme option 'page_sidebar_items'",
)
assert len(warnings) == len(expected_warnings)
for exp_warn in expected_warnings:
assert exp_warn in sphinx_build.warnings

index_html = sphinx_build.html_tree("index.html")
subpage_html = sphinx_build.html_tree("section1/index.html")
Expand Down