Skip to content

Conversation

Qubus0
Copy link
Contributor

@Qubus0 Qubus0 commented Aug 19, 2025

we've recently updated the gdscript lexer for our own documentation, this is a port of those changes to fit the godot docs

please check as many pages as you can for errors i might have missed.

also let me know if the colors are fine like this. i think some of the existing colors may be from an older theme and not quite up to date, but i didn't touch them for now.

main changes are functions having proper blue color now, global functions being purple, all classes getting the correct greens (including builtins and types having the different green), and proper colors for $String, string names and node paths

@Qubus0 Qubus0 changed the title expands the pygments lexer to cover GDScript 2 better Improve the pygments lexer to cover GDScript 2 better Aug 19, 2025
@Qubus0
Copy link
Contributor Author

Qubus0 commented Aug 19, 2025

Side by side screenshot image LexerUpdate2 LexerUpdate3

@AThousandShips AThousandShips added enhancement content:website Issues related to adding website features and fixing bugs, whether on the front or back-end labels Aug 19, 2025
@AThousandShips AThousandShips requested a review from a team August 19, 2025 16:20
Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally, it works as expected. Both dark and light theme seem to work.

image image

This is a great start, as it now looks much closer to the Godot script editor (which is the intended goal).

@Qubus0
Copy link
Contributor Author

Qubus0 commented Aug 20, 2025

Name and Punctuation didn't have css classes yet. adding them makes the () and = bluish, pretty hard to notice, and fixes code in warning callouts being yellow

image

Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great now!

Dark Light
Screenshot_20250829_225651 Screenshot_20250829_225706

I can confirm the code color in admonitions is fixed now.

@Qubus0 Qubus0 force-pushed the better-pygments-gdscript branch from f1ddeff to eafb19b Compare August 31, 2025 14:13
@Qubus0
Copy link
Contributor Author

Qubus0 commented Aug 31, 2025

singulars done, squashed everything, should be ready - let me know if anything else stands out to you

@Qubus0 Qubus0 force-pushed the better-pygments-gdscript branch from eafb19b to 6c5997c Compare August 31, 2025 14:51
@Qubus0 Qubus0 force-pushed the better-pygments-gdscript branch 2 times, most recently from 85a8f8c to b5740a5 Compare August 31, 2025 15:36
@Qubus0
Copy link
Contributor Author

Qubus0 commented Aug 31, 2025

okay, realized most of the light theme colors were outdated, so i brought everything closer to the editor theme. including the yellowed background which the editor doesn't have (improves clarity imo, might split some opinions though)

before after
image image

@Qubus0
Copy link
Contributor Author

Qubus0 commented Aug 31, 2025

Updated preview

dark light
image image
note the function declaration colors above are fixed but everything below still has the wrong ones but i didn't want to redo everything
image image
image image
image image
image image

@Qubus0 Qubus0 force-pushed the better-pygments-gdscript branch 2 times, most recently from 251b197 to eca6d94 Compare September 1, 2025 15:07
@Qubus0
Copy link
Contributor Author

Qubus0 commented Sep 1, 2025

fixed member vars color and ...args

dark light
image image

code not changed, just added for simpler screenshot

@Qubus0 Qubus0 force-pushed the better-pygments-gdscript branch from eca6d94 to 84b6484 Compare September 2, 2025 12:28
@Qubus0 Qubus0 force-pushed the better-pygments-gdscript branch from 84b6484 to 5ebeb22 Compare September 2, 2025 12:51
Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did another test locally and it looks great. Code looks good to me.

Comment on lines +336 to +344
# copied from https://docs.godotengine.org/en/stable/classes/index.html
(
words(
(
# Nodes
"Node",
"AcceptDialog",
"AnimatableBody2D",
"AnimatableBody3D",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have concerns about this. It feels like this will grow out of date quickly and would need constant updates. If there is any way at all to automate this part, I'd appreciate it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I agree automation would be nice (and I'll have a look into it), realistically I don't think this going out of date is much of an issue because

  1. The most important classes have had the same name since 4.x, they aren't renamed particularly often.
  2. New classes are rarely added to the docs right away
  3. Classes are rarely removed between major updates too
  4. If there are any outdated classes, the hue will only be off slightly
  5. And considering all of that together, the benefit of covering most of the important classes far outweighs risking missing a few less important ones

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those are some fair points. :) Maybe we can make grabbing the list from that URL during the build a future todo then, and see how it goes.

@mhilbrunner
Copy link
Member

Thanks for working on this! Overall it looks quite good to me, besides the single concern noted above.

@mhilbrunner mhilbrunner merged commit 435dea0 into godotengine:master Sep 13, 2025
1 check passed
@mhilbrunner
Copy link
Member

Thank you! Merged.

@akien-mga
Copy link
Member

Cherry-picked for 4.5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
content:website Issues related to adding website features and fixing bugs, whether on the front or back-end enhancement topic:gdscript
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants