Skip to content
Open
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
2 changes: 1 addition & 1 deletion sphinx_design/static/sphinx-design.min.css

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions style/steps.css
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@
list-style: none;
}

/* Themes can style the items too (sphinx-rtd-theme: (0,3,2)); the doubled
classes outrank them. */
.sd-steps.sd-steps > .sd-step.sd-step {
list-style: none;
margin-inline-start: 0;
}

.sd-step {
position: relative;
/* room for the marker + connecting rail on the inline-start side */
Expand Down
20 changes: 20 additions & 0 deletions tests/test_css.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,26 @@ def test_tab_label_hover_differs_from_active():
]


def test_step_marker_outranks_theme_list_item_rules():
"""A step shows only its own marker when a theme styles ``ol li``.

sphinx-rtd-theme sets ``list-style: decimal`` and ``margin-left`` on the
list items themselves, not on the list, so hiding the ``<ol>`` marker is
not enough: the step item rule must outrank the theme's item rule.
"""
pytest.importorskip("tinycss2")
import check_css_equivalence # noqa: PLC0415

css = ARTIFACT.read_text(encoding="utf8")
rules = re.findall(r"([^{}]*\.sd-step\b[^{}]*)\{([^{}]*)\}", css)
item_rules = [sel for sel, body in rules if "list-style:none" in body]
assert item_rules, "no rule hides the native marker on .sd-step"
rtd_item = ".rst-content .section ol.arabic li"
assert max(
check_css_equivalence._specificity_of_simple(sel) for sel in item_rules
) > check_css_equivalence._specificity_of_simple(rtd_item)


def test_minify_output_parses_cleanly():
"""Minified (rcssmin) output of tricky-but-valid CSS must stay valid.

Expand Down