There's also a pure-Rust implementation of a syntax highlighter, which uses TextMate/SublimeText grammars: https://lib.rs/syntect
Arborium: Tree-sitter code highlighting with Native and WASM targets
41–48 of 48 posts
Re: Arborium: Tree-sitter code highlighting with Native and WASM targets
#42Earlier quoted context omitted.
The example on their website is editable and it looks like they overlay the highlighted output on top of the textarea with `pointer-events: none` like you mentioned. The code isn't minified so you can see how they do it by looking at the `doHighlight()` function here https://arborium.bearcove.eu/pkg/app.generated.js
Oh, you are right! Hmm .. and the approach already shows its weaknesses when I play with it: When I search for something on the page, it gives me twice as many hits as there are. And jumps around two times to each hit when I use the "next" button. I wonder if that is fixable.
https://github.blog/engineering/architecture-optimization/cr...
Re: Arborium: Tree-sitter code highlighting with Native and WASM targets
#43Earlier quoted context omitted.
Oh, you are right! Hmm .. and the approach already shows its weaknesses when I play with it: When I search for something on the page, it gives me twice as many hits as there are. And jumps around two times to each hit when I use the "next" button. I wonder if that is fixable.
One simply needs the Highlight API. I held back, but now even Firefox ESR supports it. https://developer.mozilla.org/en-US/docs/Web/API/Highlight All the trickery vanishes and you get first-class CSS support.
Re: Arborium: Tree-sitter code highlighting with Native and WASM targets
#44Re: Arborium: Tree-sitter code highlighting with Native and WASM targets
#45Re: Arborium: Tree-sitter code highlighting with Native and WASM targets
#46Earlier quoted context omitted.
Oh, you are right! Hmm .. and the approach already shows its weaknesses when I play with it: When I search for something on the page, it gives me twice as many hits as there are. And jumps around two times to each hit when I use the "next" button. I wonder if that is fixable.
One simply needs the Highlight API. I held back, but now even Firefox ESR supports it. https://developer.mozilla.org/en-US/docs/Web/API/Highlight All the trickery vanishes and you get first-class CSS support.
Re: Arborium: Tree-sitter code highlighting with Native and WASM targets
#47Earlier quoted context omitted.
Haha, I confess I did sound like a bot... but sorry to disappoint, I am human!
That's what a bot would typically say. On this side, I'm not a bot, and fortunately even in 2025 nobody on the internet knows that you are a dog.
Re: Arborium: Tree-sitter code highlighting with Native and WASM targets
#48Earlier quoted context omitted.
That's what a bot would typically say. On this side, I'm not a bot, and fortunately even in 2025 nobody on the internet knows that you are a dog.
I think I sound a bit like a bot because half of what I read on the Internet is actually written by bots and that is influencing me!