-
Notifications
You must be signed in to change notification settings - Fork 80
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
Vendor GitHub css #469
Vendor GitHub css #469
Conversation
@@ -63,3 +63,12 @@ newline <- function(x) paste0(x, "\n") | |||
is_testing <- function() { | |||
identical(Sys.getenv("TESTTHAT"), "true") | |||
} | |||
|
|||
is_dark_mode <- function() { | |||
if (rstudioapi::isAvailable() && rstudioapi::hasFun("getThemeInfo")) { |
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.
Once posit-dev/positron#2986 is handled, the full glory of this PR will apply in Positron.
theme_info <- rstudioapi::getThemeInfo() | ||
theme_info$dark | ||
} else { | ||
FALSE |
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.
Until posit-dev/positron#2986 happens, Positron will always get reprex previews in light mode, but this is still an improvement over what's happening now.
Before this PR:
After this PR:
:root { | ||
--bg-color: #0d1117; | ||
} |
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.
I added this. (Ditto in github-light.css
.)
-webkit-text-size-adjust: 100%; | ||
margin: 0; | ||
color: #e6edf3; | ||
background-color: var(--bg-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.
Changed this to a variable. (Ditto in github-dark.css
.)
max-width: 980px; | ||
margin: 0 auto; | ||
padding: 45px; | ||
padding-top: 15px; |
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.
Some new padding at the top.
|
||
<body> | ||
|
||
<div class="markdown-body"> |
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.
New div because markdown-body
that is the main class that GitHub's CSS deals with.
In your examples e.g. "With this PR, Positron, light mode", it looks like syntax highlighting is missing? |
Yeah, I had noticed that as well. Working on it. So far without much success, but presumably solvable. |
I have (more than) solved the syntax highlighting problem, but lordy was it a journey. I'm closing this PR and will make a new one with a clean history that actually helps tell the story. |
Fixes #468
The basic approach is to get GitHub's CSS from a more definitive source than the rmarkdown package. Then I have to fix it up a bit to play well with an html template, which we also bring into reprex now.
If you really wanted a faithful preview, there's a GitHub API endpoint that will take markdown and render HTML as GitHub would. But that seems like overkill.
Skimming through the individual commits is probably the easiest way to see what I've tweaked in the files I'm getting from elsewhere.