-
-
Notifications
You must be signed in to change notification settings - Fork 978
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
Update stylesheet for code blocks with line-numbers #1596
base: main
Are you sure you want to change the base?
Conversation
I just noticed the background color of the |
My update CSS in the below looks too fat. pre:not([class]),
pre[class="sourceCode numberSource numberLines"],
pre[class="sourceCode numberSource numberLines lineAnchors"],
pre[class="sourceCode numberSource numberLines line-anchors"],
pre[class="sourceCode numberSource number-lines"],
pre[class="sourceCode numberSource number-lines lineAnchors"],
pre[class="sourceCode numberSource number-lines line-anchors"],
pre[class="sourceCode numberSource lineAnchors numberLines"],
pre[class="sourceCode numberSource lineAnchors number-Lines"],
pre[class="sourceCode numberSource line-anchors numberLines"],
pre[class="sourceCode numberSource line-anchors number-lines"] {
background-color: white;
} I feel I can remove the lines mixing up camelCases and kebab-cases, which is a bad manner and most users won't do it (I hope). pre:not([class]),
pre[class="sourceCode numberSource numberLines"],
pre[class="sourceCode numberSource numberLines lineAnchors"],
pre[class="sourceCode numberSource lineAnchors numberLines"],
pre[class="sourceCode numberSource number-lines"],
pre[class="sourceCode numberSource number-lines line-anchors"],
pre[class="sourceCode numberSource line-anchors number-lines"] {
background-color: white;
} What do you think? |
Because this is fixed by PR rstudio#1598
This part is approached by #1598, and thus is reverted. |
9ce8b28
to
2e8b846
Compare
This PR update stylesheet for code blocks with line-numbers.
Examples are at the bottom.
Changes
Background of
<div class="sourceCode">
is changed to transpreant.In some syntax highlighting, background color of
<div class="sourceCode">
are specified (e.g., tango)This cause ugly appearance especially in
theme: darkly
As long as line numbers are not used, background color of the
div
tags are not visible.Thus, I considered it is okay to letting them
transparent
.Background of
pre
for chunk output are changed to whitePreviously, specifying
class.output="numberLines"
caused output code block to have gray background where white is expected.This is fixed by exact matching of class attributes.
Thus, white background are only applied when
The latter is approached by the exact matching of classes.
Exact matching is required for the backward compatibility.
Otherwise, Bootstrap would not work to fill background colors for example by
class.output = "numberLines bg-warning"
.Note
If the output
pre
tag has thelineAnchors
class, but not thenumberLines
, it is filled with gray.Because line numbering is not working.
Examples
Before
After
Source