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

Regex: Added aliases and minor improvements #2325

Merged
merged 2 commits into from
May 7, 2020

Conversation

RunDevelopment
Copy link
Member

After this reminder, I added aliases to some regex tokens to add some actual highlighting. Before this, regex did tokenized regular expressions but intentionally used token names not recognized by any theme because I felt at the time that the usual colors didn't fit regexes.

Improvements:

  • Removed backreferences from charsets.
  • The dot . is no longer highlighted as a character class inside charsets.
  • Added support for lazy ? and possessive + quantifier.

The aliases:

I added aliases so that regexes look reasonably well with all themes without making any modifications to any theme. It's not perfect since themes simply weren't built with regex tokenization in mind but I think it's ok.

Screenshots

image
image
image
image
image
image
image
image

@RunDevelopment RunDevelopment merged commit 8a72830 into PrismJS:master May 7, 2020
@RunDevelopment RunDevelopment deleted the regex-styling branch May 7, 2020 20:44
quentinvernot pushed a commit to TankerHQ/prismjs that referenced this pull request Sep 11, 2020
This adds a lot of aliases to the regex tokens, so themes can apply their styles. It also makes a few improvements. See the PR for more details.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant