27.5KB language-agnostic WebGPU syntax highlighter
11–20 of 39 posts
Re: 27.5KB language-agnostic WebGPU syntax highlighter
#12https://repo.autonoma.ca/repo/treetrek/tree/HEAD/render/rule...
Re: 27.5KB language-agnostic WebGPU syntax highlighter
#13If anyone can get in contact with Shu, please let them know I'd really like to speak with them. I have a deterministic rendering / colorizing system in three dimensions instead of two for arbitrary UTF8 text written that is explicitly GPU bound and currently testing the last Rust + Mojo pair port, and I'd like to share some ideas. I have about 95 million glyphs rendering (monospace, atm) in a little under a second wi…
Re: 27.5KB language-agnostic WebGPU syntax highlighter
#14Earlier quoted context omitted.
The use case isn't highlighting a huge amount of code, but local re-entrant highlighting. You generally never need to highlight a whole file, only the part you're looking at. Which by definition must be fuzzy since you don't have the full source, the part you see will not parse as a complete program so you need to guess. This is actually one of the nastier parts of writing a highlighter, and it must be done for every…
Is that really the use case for the related packages mentioned on their website? highlightjs and prismjs are typically used to highlight code snippets on websites… which are at most a few hundred lines long. And are usually highlighted as a whole
Re: 27.5KB language-agnostic WebGPU syntax highlighter
#15Re: 27.5KB language-agnostic WebGPU syntax highlighter
#16Re: 27.5KB language-agnostic WebGPU syntax highlighter
#17Is this a linux issue / support issue?
Re: 27.5KB language-agnostic WebGPU syntax highlighter
#18On linux (tried FF and chromium), the live demo renders all the text as black (no highlighting). On iOS (my phone), this works great. No errors in the console (maybe it fails silently?) Is this a linux issue / support issue?
WebGPU on Linux is still the exception, not the rule. Firefox ships it enabled by default in Nightly only, not Stable or Beta, with Linux expected during 2026. Chrome enables it by default on Linux only for Intel Gen12+ (from 144) and NVIDIA with driver 535.183.01+ on Wayland (from 147); everything else is behind flags, roughly --enable-unsafe-webgpu --ozone-platform=x11 --use-angle=vulkan --enable-features=Vulkan,VulkanFromANGLE. Distro Chromium builds also differ from Google Chrome here more often than people expect.
Which matches what you saw exactly: works on iOS, black text on both Linux browsers, clean console. Worth the demo printing a one-line "WebGPU unavailable" instead of rendering black on black, because right now a missing API and a broken shader look identical from the outside.
Re: 27.5KB language-agnostic WebGPU syntax highlighter
#19I don't think it's meant as something that's useful per se because highlighting 5m lines of code at once is unusual, and doing it in a non-deterministic way probably isn't especially helpful, but to show what a browser is capable of it's awesome.
Speak for yourself, I often accidentally open 50MB JSON files, crashing my text editor as it tries to figure out the syntax highlighting :)
Re: 27.5KB language-agnostic WebGPU syntax highlighter
#20I don't think it's meant as something that's useful per se because highlighting 5m lines of code at once is unusual, and doing it in a non-deterministic way probably isn't especially helpful, but to show what a browser is capable of it's awesome.
> highlighting 5m lines of code at once is unusual Speak for yourself, I often accidentally open 50MB JSON files, crashing my text editor as it tries to figure out the syntax highlighting :)