-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Improve CSS for source code block line numbers #143192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Some changes occurred in HTML/CSS/JS. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks fine for the most part, just a few non-obvious things that could be clarified, and a few tiny edge cases that could hypothetically be improved, although I'm not sure if we care to, given how niche they are.
do we care about keeping git blame
output clean? because rearranging things needlessly would degrade that slightly.
.example-wrap.digits-1 { --example-wrap-digits-count: 1ch; } | ||
.example-wrap.digits-2 { --example-wrap-digits-count: 2ch; } | ||
.example-wrap.digits-3 { --example-wrap-digits-count: 3ch; } | ||
.example-wrap.digits-4 { --example-wrap-digits-count: 4ch; } | ||
.example-wrap.digits-5 { --example-wrap-digits-count: 5ch; } | ||
.example-wrap.digits-6 { --example-wrap-digits-count: 6ch; } | ||
.example-wrap.digits-7 { --example-wrap-digits-count: 7ch; } | ||
.example-wrap.digits-8 { --example-wrap-digits-count: 8ch; } | ||
.example-wrap.digits-9 { --example-wrap-digits-count: 9ch; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this really the best way to do this? It very well may be "good enough", but here's some misc thoughts:
- pretty sure you can define
--
variables in astyle
attribute then have the styles of child elements reference them withvar
. This way we could have the render logic pass an actual integer on to css instead of an integer-like enum. - if a rust file used the maximum possible file size and made each line use an average of 4 bytes or less, including newlines, it would have a 10 digit number of lines. Do we ever generate a
digits-10
css class?
.example-wrap [data-nosnippet]:target { | ||
border-right: none; | ||
} | ||
:root.word-wrap-source-code .example-wrap.digits-9 pre > code { | ||
padding-left: calc( | ||
9ch + var(--line-number-padding) * 2 + var(--line-number-right-margin)); | ||
.example-wrap .line-highlighted[data-nosnippet] { | ||
background-color: var(--src-line-number-highlighted-background-color); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason for moving this? I would say it improves organization, but there's other .example-wrap
rules above.
I would say if anything, the following .example-wrap.hide-lines
should be moved up to where the other .example-wrap
rules are.
I suppose it doesn't really matter outside a very small chance a PR that would not have conflicted before would conflict due to this change, and making git blame
output slightly less useful.
@@ -8,6 +8,8 @@ | |||
3. Copy the filenames with updated suffixes from the directory. | |||
*/ | |||
|
|||
/* ignore-tidy-filelength */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This somewhat confuses me due to the fact that this file has actually gotten smaller, though it probably is correct to have here even if it isn't needed yet.
Extract some changes from #137229 to make the PR smaller (thanks @yotamofek for the suggestion!).
r? notriddle