Issue with Highlight Keywords
See original GitHub issueOk, well this might no be exactly an “issue” as this actually relates to items that are not keywords. However, what I’d like to do is highlight a token that isn’t a keyword.
The language I selected was C++ and there are macros in my code. I want to highlight those macro names. How would I do that?
Another thing I noticed with Highlight Keywords is the documentation. I was looking at it and it showed the following:
.token.keyword.keyword-return, .token.keyword.keyword-if{
color: #f92672;
}
Well, I tried this and it didn’t work. It took some time in reading and debugging as to what this actually did and I found out what was wrong. I don’t know why .token.keyword were prefixed to the style selector, but that is what the issue was. It should be:
.keyword-return, .keyword-if{
color: #f92672;
}
As a side note. I find this library very nice. Thanks to all who are involved in this project. It makes it easy to style code snippets and is fairly easy to use. Thanks again.
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (3 by maintainers)
If you can write regex, best bet, I think, would be to modify the language definition at runtime, or create an extended language definition. You can see here how C++ extends the C language. You can extend C++ w/ like a “C++ Extras” that includes the keywords you want highlighted, then highlight your code snippets with your new language.
So it doesn’t reference anything outside? Then I’m at a loss. Now seems to be working with what was documented and doesn’t work with what I’m saying. Very weird.