fix editor so accented letters get the same color as the rest of the …#1906
Open
joelkemkeng wants to merge 1 commit intomermaid-js:developfrom
Open
fix editor so accented letters get the same color as the rest of the …#1906joelkemkeng wants to merge 1 commit intomermaid-js:developfrom
joelkemkeng wants to merge 1 commit intomermaid-js:developfrom
Conversation
…label The Monarch tokenizer was using \w for word characters, which only covers basic ASCII letters. So when you had something like cafe with an accent or other diacritics in a diagram, that part was getting a different token and showed up in a different color. Extended the patterns to include Latin extended (U+00C0 to U+024F) so those characters are treated as part of the same token. Resolves mermaid-js#1657 Made-with: Cursor
✅ Deploy Preview for mermaidjs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
I've checked the preview deploy and it works! Thank you so much! :) |
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📑 Summary
Fix for the code editor: accented characters (é, ñ, ü, etc.) in diagram labels no longer get a different color than the rest of the text. They’re now highlighted like the rest of the label.
Resolves #1657
📏 Design Decisions
The syntax highlighting uses the Monarch tokenizer with regexes that relied on \w for “word” characters. In JavaScript that’s only [a-zA-Z0-9_], so letters with accents or other diacritics weren’t part of the same token and were colored differently. I extended the tokenizer patterns to include the Latin extended range (U+00C0–U+024F) so those characters are treated as part of the same token (variable/string) and keep the same color as the rest of the label. No change to the themes, only to which characters are grouped into each token.
📋 Tasks
Make sure you
📖 have read the
contribution guidelines
💻 have added unit/e2e tests (if appropriate)
🔖 targeted
develop
branch