Noticed some less than perfect syntax highlighting on a blog post, and thought to fix the issue upstream in rouge.
In typescript, 'as' and 'satisfies' are type assertion operator, while 'satisfies' is a type operator. There is no 'as' keyword in javascript, and the way the rule was written, functions named "as" were being marked as keywords, rather than functions.
I took the rule from a textmate grammar, and modified it to work in rouge.
I also tested this commit against my blog, and noticed the improved syntax highlighting there.
Now, "satisfies" and "as" are marked as keywords where they are used in a keyword way.
Here are three screenshots, before, after, and delta of visual lexer test.
Before
The "satisfies" is not bolded, and the "as" in the function names are bolded. Not ideal.
After
The "satisfies" is bolded, and the function names are not bolded, with no regressions to the other "as"
Delta
white is unchanged, teal is text that was made unbolded, and yellow is bolded.
Howdy!
Noticed some less than perfect syntax highlighting on a blog post, and thought to fix the issue upstream in rouge.
In typescript, 'as' and 'satisfies' are type assertion operator, while 'satisfies' is a type operator. There is no 'as' keyword in javascript, and the way the rule was written, functions named "as" were being marked as keywords, rather than functions.
I took the rule from a textmate grammar, and modified it to work in rouge.
I also tested this commit against my blog, and noticed the improved syntax highlighting there.
Now, "satisfies" and "as" are marked as keywords where they are used in a keyword way.
Here are three screenshots, before, after, and delta of visual lexer test.
Before
The "satisfies" is not bolded, and the "as" in the function names are bolded. Not ideal.
After
The "satisfies" is bolded, and the function names are not bolded, with no regressions to the other "as"
Delta
white is unchanged, teal is text that was made unbolded, and yellow is bolded.