summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiDeoo2025-04-07 16:37:45 +0200
committerGitHub2025-04-07 16:37:45 +0200
commit82deb847418aedb9c01e05bb9de4b9bd10a1a885 (patch)
treeddb77a07e4e5b63658df1557a567feefb4c32683
parent2768932065980d7e1b2fc615706b605a9527fb36 (diff)
downloadIT.starlight-82deb847418aedb9c01e05bb9de4b9bd10a1a885.tar.gz
IT.starlight-82deb847418aedb9c01e05bb9de4b9bd10a1a885.tar.bz2
IT.starlight-82deb847418aedb9c01e05bb9de4b9bd10a1a885.zip
Fix list styling issue (#3026)
Co-authored-by: Chris Swithinbank <swithinbank@gmail.com>
-rw-r--r--.changeset/calm-cobras-breathe.md11
-rw-r--r--CONTRIBUTING.md2
-rw-r--r--packages/starlight/style/markdown.css24
3 files changed, 35 insertions, 2 deletions
diff --git a/.changeset/calm-cobras-breathe.md b/.changeset/calm-cobras-breathe.md
new file mode 100644
index 00000000..babcfe33
--- /dev/null
+++ b/.changeset/calm-cobras-breathe.md
@@ -0,0 +1,11 @@
+---
+'@astrojs/starlight': minor
+---
+
+Fixes a potential list styling issue if the last element of a list item is a `<script>` tag.
+
+⚠️ BREAKING CHANGE:
+
+This release drops official support for Chromium-based browsers prior to version 105 (released 30 August 2022) and Firefox-based browsers prior to version 121 (released 19 December 2023). You can find a list of currently supported browsers and their versions using this [browserslist query](https://browsersl.ist/#q=%3E+0.5%25%2C+not+dead%2C+Chrome+%3E%3D+105%2C+Edge+%3E%3D+105%2C+Firefox+%3E%3D+121%2C+Safari+%3E%3D+15.4%2C+iOS+%3E%3D+15.4%2C+not+op_mini+all).
+
+With this release, Starlight-generated sites will still work fine on those older browsers except for this small detail in list item styling, but future releases may introduce further breaking changes for impacted browsers, including in patch releases.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 509de94c..8e68e3fc 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -275,7 +275,7 @@ To add a language, you will need its BCP-47 tag and a label. See [“Adding a ne
- Components that require client-side JavaScript or CSS should use JavaScript/CSS features that are well-supported by browsers.
- You can find a list of supported browsers and their versions using this [browserslist query](https://browsersl.ist/#q=%3E+0.5%25%2C+not+dead%2C+Chrome+%3E%3D+88%2C+Edge+%3E%3D+88%2C+Firefox+%3E%3D+98%2C+Safari+%3E%3D+15.4%2C+iOS+%3E%3D+15.4%2C+not+op_mini+all). To check whether or not a feature is supported, you can visit the [Can I use](https://caniuse.com) website and search for the feature.
+ You can find a list of supported browsers and their versions using this [browserslist query](https://browsersl.ist/#q=%3E+0.5%25%2C+not+dead%2C+Chrome+%3E%3D+105%2C+Edge+%3E%3D+105%2C+Firefox+%3E%3D+121%2C+Safari+%3E%3D+15.4%2C+iOS+%3E%3D+15.4%2C+not+op_mini+all). To check whether or not a feature is supported, you can visit the [Can I use](https://caniuse.com) website and search for the feature.
[discord]: https://astro.build/chat
[issues]: https://github.com/withastro/starlight/issues
diff --git a/packages/starlight/style/markdown.css b/packages/starlight/style/markdown.css
index 2fe23920..fbaf9683 100644
--- a/packages/starlight/style/markdown.css
+++ b/packages/starlight/style/markdown.css
@@ -24,7 +24,29 @@
.sl-markdown-content
li
- > :last-child:not(li, ul, ol, a, strong, em, del, span, input, code, br, :where(.not-content *)) {
+ > :is(
+ :last-child:not(
+ li,
+ ul,
+ ol,
+ a,
+ strong,
+ em,
+ del,
+ span,
+ input,
+ code,
+ br,
+ script,
+ :where(.not-content *)
+ ),
+ /**
+ * For list items ending with 1 or multiple script elements (`:has(~ script:last-child)`), we
+ * need to style the last non-script element (`:not(script)`) that doesn't have a subsequent
+ * sibling that is not a script (`:not(:has(~ :not(script)))`).
+ */
+ :not(script):has(~ script:last-child):not(:has(~ :not(script)))
+ ) {
margin-bottom: 1.25rem;
}