Skip to content

Conversation

@alanhdu
Copy link
Contributor

@alanhdu alanhdu commented Jan 27, 2024

This changes the Rust lexer to handle ::, :, and -> better. Previously, all of these tokens would labeled as text, which leads to poor rendering on certain styles. For instance, using a monokai HTML style w/ inline CSS, I get

image

where the tokens are rendered using the default (black) text which is not really visible against the background.

This changes the lexer so that:

  • : and -> are considered punctuation
  • :: is considered an operator -- I am not entirely sure that's the correct thing to do, but it seems like a resaonable choice
  • I went through and used Text.Whitespace instead of plain Text a little more thoroughly.

@jeanas jeanas merged commit cf57066 into pygments:master Jan 28, 2024
@jeanas
Copy link
Contributor

jeanas commented Jan 28, 2024

Thanks!

@alanhdu alanhdu deleted the alan/rust branch January 29, 2024 20:01
@Anteru Anteru added the A-lexing area: changes to individual lexers label Feb 17, 2024
@Anteru Anteru added this to the 2.18.0 milestone Feb 17, 2024
@Anteru Anteru added the changelog-update Items which need to get mentioned in the changelog label Feb 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-lexing area: changes to individual lexers changelog-update Items which need to get mentioned in the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants