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

feature request: support diff highlighting #31

Open
drammock opened this issue Oct 19, 2023 · 2 comments
Open

feature request: support diff highlighting #31

drammock opened this issue Oct 19, 2023 · 2 comments
Labels
type: enhancement 💅🏼 New feature or request

Comments

@drammock
Copy link

Over at Pydata-Sphinx-Theme we've had a user request to support .diff highlighting: pydata/pydata-sphinx-theme#1506

I haven't looked at all the themes in this repo, but I looked at a11y_high_contrast_dark and _light and here is (I think) the problem:

  • Generic.Inserted is undefined
  • Generic.Deleted, Generic.Heading and Generic.Subheading are all defined as the same color (Colors.blue)

# Generic: "", # class: 'g'
Generic.Deleted: Colors.blue, # class: 'gd',
Generic.Emph: "italic", # class: 'ge'
# Generic.Error: "", # class: 'gr'
Generic.Heading: Colors.blue, # class: 'gh'
Generic.Subheading: Colors.blue, # class: 'gu'
# Generic.Inserted: "", # class: 'gi'
# Generic.Output: "", # class: 'go'
# Generic.Prompt: "", # class: 'gp'
Generic.Strong: "bold", # class: 'gs'
# Generic.Traceback: "", # class: 'gt'

I think what is needed is to define Inserted as Colors.green, change Deleted to Colors.red, and (maybe?) change either Heading or Subheading so they are different from one another. The addition of Inserted probably means that a gi class should get added to the CSS files too (unless those are auto-generated? I don't have much experience with pygments development).

For reference, in Monokai (which has better diff highlighting), Deleted is pink, Inserted is a light-yellowish-green, Subheading is a sort of greenish-light-grey, and Heading is undefined.

https://github.com/pygments/pygments/blob/8f3bec7982ba52915ee95f34f18e188243364600/pygments/styles/monokai.py#L100-L111

@trallard
Copy link
Member

Thanks for opening this issue @drammock - I will look into these improvements. But since I am going to be on a few weeks leave this fix might only be available in a month or so.

@Carreau
Copy link
Collaborator

Carreau commented Apr 18, 2024

I was talking with @trallard and I believe there are a few things we can try/do.

  • generate thumbnails with diff.

I believe it is possible to highlight not only the diff but the underlying language as well. This raise some questions, how do you handle colors, the way other things handle this is that inserted/removed only change the background of the lines.

  • Look into a decide wether we can use muted version of greed/red to represent diffs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement 💅🏼 New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants