Use @scope to scope our Markdown rules
#3619
delucis
started this conversation in
Feature Requests
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
What version of
starlightare you using?0.37.1
What is your idea?
Switch to using
@scopefor limiting where our Markdown styles apply.We can’t do this yet as browser support is not sufficient for us, but we should switch eventually.
Why is this feature necessary?
Starlight lets users opt out of Markdown styles using the
not-contentclass. Currently we implement this using a:not(:where(.not-content *))selector that looks like this in context:starlight/packages/starlight/style/markdown.css
Lines 30 to 32 in 4b8171c
Except, sometimes it also gets a lot less simple 😬
starlight/packages/starlight/style/markdown.css
Lines 8 to 14 in 4b8171c
We should be able to refactor all these styles to be wrapped in a single
@scopeinstead and simplify the code significantly. For example, styles can become a lot easier to reason about when the scoping logic is pulled up to an@scopeblock (which we’d need just once wrapping everything in ourmarkdown.cssfile:Before:
After:
Do you have examples of this feature in other projects?
Support only just landed in FF and this is an implementation detail, so not something users necessarily notice, but would make our maintenance lives simpler!
Participation
Beta Was this translation helpful? Give feedback.
All reactions