-
Notifications
You must be signed in to change notification settings - Fork 14
Improve syntax highlighting in code samples a bit! #160
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
Improve syntax highlighting in code samples a bit! #160
Conversation
I've also just added There's a massive master list of every function in the engine in the |
Removed the need for the negative look-behind and look-ahead assertions. This means we don't have to worry about the difference between `\n` and `<br>` during highlighting, and should make it faster and more supported across browsers again.
Alrighty, I'm back again! I've made a slight modification to the |
These haven't been supported since GM:S 1.4, so they don't really need to be here.
I made few pull requests for highlight.js from time to time, updating GML ( https://github.com/highlightjs/highlight.js/pulls?q=is%3Apr+author%3Agnysek+is%3Aclosed ), but with it rapid updates it's for sure out of date again. Latest version I've updated was 2024.2 - so if you have any newer definitions file, would be nice to update it in hightlight.js repo too! :) |
Heya! I thought about porting it across but I'm unfamiliar with contributing to that project - I've made substantial changes to how the language definition for GML works and might have a few more edge cases to sort out I've not found. I'm now quite sure the manual list of function names in there is made unnecessary by my changes so will go ahead with removing it. If/when this PR is accepted, I'll happily open one in highlight.js itself to backport my changes, which should make the highlighting in Discord etc. much better (eventually!) :) |
We now detect function call sites by signature, not by a manual list of what functions exist, so this is no longer necessary!
Just gone ahead with removing that massive function list as I'm now quite certain it was only used for manually highlighting function calls. Since that's now done by signature, I've removed that list and it won't need manual updating anymore :) |
Merged. Thank you so much for your work! |
I was having a look at the manual and again noticed how bare-bones the syntax highlighting is, how it is missing keywords such as
new
andstatic
, how it doesn't highlight variable colours, struct members... and so on. I decided today to take it upon myself to have a go learning some of highlight.js's s way of defining language highlighers and use that to improve the manual's highlighting, as it uses this library for it.The changes are as follows, with before and after images!
new
keyword is highlighted:Before:

After:

#macro
,#region
,#endregion
are highlighted, including comment highlighting for the latter two, and constant colouring for the identifier for macros:Before:


After:


Before:

...note that it didn't even pick up GML as the language here as it didn't see it as valid syntax.
After:

Before:


After:


Before:

After:

throw
keyword is highlighted:Before:

After:

global
:Before:


After:


obj_*
,spr_*
andshader_*
as asset constant colours:Before:

After:
