Skip to content
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

Inline code is not highlighting when using "darkly" theme #2390

Closed
sir-farts-alot opened this issue Jul 19, 2022 · 7 comments
Closed

Inline code is not highlighting when using "darkly" theme #2390

sir-farts-alot opened this issue Jul 19, 2022 · 7 comments
Labels
feature a feature request or enhancement theme: highlight

Comments

@sir-farts-alot
Copy link

I hope the issue is clear enough.
Please suggest a solution. Thanks.

@cderv
Copy link
Collaborator

cderv commented Jul 19, 2022

Unfortunately, this is not supported by Pandoc which is in charge of the highlighting: jgm/pandoc#7560 and jgm/skylighting#122

You can do that or now by applying a custom CSS style derived from you dark theme. (using css chunk or passing style in css argument. For PDF, you would need to pass a custom preamble I guess. I don't know how to customize this for LaTeX TBH.

We could try to bring better support for HTML at least in rmarkdown directly by getting the background information of the Pandoc style used and add a CSS style based on it.

@cderv cderv added feature a feature request or enhancement theme: highlight labels Jul 19, 2022
@sir-farts-alot
Copy link
Author

@cderv
Thanks for the reply.
Can you please help me with what needs to be changed in CSS, I'm clueless about it. Thanks.

@cderv
Copy link
Collaborator

cderv commented Jul 19, 2022

This is a great exercise to learn about CSS ! Use the inspector in your browser to find the inline code element and its applied style.
Some resources to learn CSS:

You would need to

  • Inspect your dark code block to find the color applied
  • Inspect the inline code block to get the correct selector to apply the same style as in code block.

I let you with the exercice and come back later this week if you can't manage to made it work. Please share back what you tried in the meantime (Also doing it because you did not share a reproducible example of what you are doing and I don't have the time right now to create one, trying to guess your specific usage - if you share back more info, it will be easier to help)

@sir-farts-alot
Copy link
Author

sir-farts-alot commented Jul 19, 2022

@cderv
Tbh, learning CSS just to fix one issue seems like too much to me. I'm not a developer or have anything to do in this field.
But rmardown is so easy that the site turned out to be great without even learning HTML
Though there is a lack of themes for dark mode still one is good enough.

Below is my issue.
test.zip

image

Please look into this if it's not too much work. Thanks.

@cderv
Copy link
Collaborator

cderv commented Jul 19, 2022

Tbh, learning CSS just to fix one issue seems like too much to me. I'm not a developer or have anything to do in this field.
But rmardown is so easy that the site turned out to be great without even learning HTML

yes I agree. And this is the case if you stay within supported feature and default behavior. If you want to customize or add specific support, you will need to add a bit of CSS / JS for HTML output, and LaTeX for PDF.

Honestly, this is really useful skills if you produce HTML document to understand and now how to tweak a CSS theme.

Example with zenburn style looking in HTML how is the color of this style and appplying to inline code

---
output: 
 html_document:
   highlight: zenburn
---

```{css, echo = FALSE}
p > code {
 background-color: rgb(48, 48, 48);
 color: rgb(204, 204, 204);
}
```

Hi!

Below is a inline code which is not highlighting with "darkly" theme.

`blah blah`

See, that blah blah supposed to be higlighted, but it isn't. 
It works fine in all other themes but issue is only with "darkly"

```{r}
1 + 1
```

hope it helps

@sir-farts-alot
Copy link
Author

Thanks, sir 👍 worked.

@github-actions
Copy link

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature a feature request or enhancement theme: highlight
Projects
None yet
Development

No branches or pull requests

2 participants