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

highlight-style treated differently for format: * and format: live-* #10717

Closed
mine-cetinkaya-rundel opened this issue Sep 4, 2024 · 6 comments
Labels
bug Something isn't working extensions relates to Quarto extensions mechanism third-party Issues involving interaction with a third-party library

Comments

@mine-cetinkaya-rundel
Copy link

I have a website project with revealjs slides and html files in it.

I set highlight-style: a11y-dark at the metadata level.

In both live-revealjs and live-html outputs, the non-interactive code cells use the correct highlight style:

Screenshot 2024-09-04 at 4 54 15 PM Screenshot 2024-09-04 at 4 54 35 PM

However, in the interactive (webr) code cells, a different style is applied.

Screenshot 2024-09-04 at 4 56 17 PM Screenshot 2024-09-04 at 4 55 59 PM

Note that this doesn't happen if highlight-style: github, for example.

cc @cderv

@georgestagg
Copy link

georgestagg commented Sep 5, 2024

Currently, the background colour for the Quarto Live code editor is decided by the following rules in CSS:

  • --bs-body-bg if it exists, or
  • --r-background-color if it exists, or
  • #ffffff, if the Quarto theme is light, or
  • #222222, if the Quarto theme is dark.

So the issue happens when the highlighting theme requires that code is typeset on a dark background, but the Quarto theme otherwise has a light background on the web page.

This is a problem that should really be fixed in Quarto Live. The CSS for the live editor should listen to the highlighter theme in some way to provide a dark background if required.

I will need to think about this a bit, I think the assumption that a "light" highlighter theme will be used with a "light" quarto theme is pretty strong in Quarto Live's CSS rules right now.

@mine-cetinkaya-rundel
Copy link
Author

What's unclear to me is which syntax highlighting is the light one using? It's not a11y (the light version of a11y-dark. It's very difficult to read. Otherwise, I'd be ok with even if it doesn't necessarily match the rest of the highlighting.

@georgestagg
Copy link

It's a11y-dark's syntax highlighting rules, but with an inverted background and base text colour. The base text colour is broken in the same way as described above.

We're working on exporting both the correct background and base text colours in #10722 so that Quarto Live can set them correctly in the editor.

For the moment a short term workaround is to avoid mixing a light Quarto theme with a dark highlighting theme (i.e setting a11y-light should work okay, if I'm understanding everything correctly).

@mcanouil mcanouil added bug Something isn't working third-party Issues involving interaction with a third-party library extensions relates to Quarto extensions mechanism labels Sep 5, 2024
@cderv
Copy link
Collaborator

cderv commented Sep 23, 2024

This is now to follow up on #10722.

In next quarto 1.6, any SCSS variable will be made available as CSS root variable with namespace --quarto-scss-export-*

We don't have yet a full extensive list of available variable, and this is quite new, but still can be used to access value set to color like code background.

Should help solve this issue in quarto-live.

@cderv cderv closed this as completed Sep 23, 2024
@georgestagg
Copy link

Apologies for the delay but the latest commit of Quarto Live now makes use of the --quarto-scss-export-code-block-color and --quarto-scss-export-code-block-bg variables.

We should still deal with the gutter in the future, but for now at least the code should be readable in the main body of the Quarto Live editor and match more closely Quarto's own code blocks.

Image

@georgestagg
Copy link

Note that there's still an issue when using a11y-dark with an otherwise light theme. I've written up the technical details at: #10722 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working extensions relates to Quarto extensions mechanism third-party Issues involving interaction with a third-party library
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants