Live data from Hacker News

Arborium: Tree-sitter code highlighting with Native and WASM targets

arborium.bearcove.eu

11–20 of 48 posts

Re: Arborium: Tree-sitter code highlighting with Native and WASM targets

#11
post #4

Sorry, but I can't understand what this actually is. A library, a stand-alone tool, a Rust crate? What users does it target? Text editors, website creators?

I think this gives some context?:https://fasterthanli.me/articles/my-gift-to-the-rust-docs-te... TLDR: for rust doc highlighting stuff in document

Re: Arborium: Tree-sitter code highlighting with Native and WASM targets

#12
post #10

https://fasterthanli.me/articles/my-gift-to-the-rust-docs-te... is a better link (the author's article about this rather than the artifact produced)

What a genius this dev is. Just a few weeks ago I tried to do something very similar for my blog, but quickly gave up as it’s not easy to do! Kudos to the author, they did an awesome job and went beyond by actually fixing up even the grammars and highlighting queries so it all works perfectly!

Re: Arborium: Tree-sitter code highlighting with Native and WASM targets

#14
post #4

Sorry, but I can't understand what this actually is. A library, a stand-alone tool, a Rust crate? What users does it target? Text editors, website creators?

It's a Rust library (comprised of a bunch of crates) that wraps a high-performance, high-accuracy syntax highlighter (called Tree-sitter) with vetted support for almost 100 programming/markup languages.

You can use it as a normal Rust library, or you can use the JavaScript/WASM wrapper to highlight source code on a web page.

Re: Arborium: Tree-sitter code highlighting with Native and WASM targets

#15
Treesitter is fantastic. It has builtin support in nvim, and there are a lot of plugins that make use of it.

My favorite is nvim-treesitter-textobjects which gives you dozens of new targets for vim motions, such as a function call or the condition of a loop.

Re: Arborium: Tree-sitter code highlighting with Native and WASM targets

#16
Great project, I really love tree-sitter, recently I added a ini variant config profile support to my app, and just use gemini to write a grammar and combine it with another great project called runestone to support highlight the config profile, the total progress is quite smooth.

Re: Arborium: Tree-sitter code highlighting with Native and WASM targets

#17
post #4

Sorry, but I can't understand what this actually is. A library, a stand-alone tool, a Rust crate? What users does it target? Text editors, website creators?

It's a Rust library (comprised of a bunch of crates) that wraps a high-performance, high-accuracy syntax highlighter (called Tree-sitter) with vetted support for almost 100 programming/markup languages. You can use it as a normal Rust library, or you can use the JavaScript/WASM wrapper to highlight source code on a web page.

> high-accuracy syntax highlighter (called Tree-sitter)

Just wanted to note that tree-sitter is lower-level and more general: it's an incremental parser that is specialised for gracefully and efficiently parsing partially-correct code snippets or code being edited live.

It's an important building block of the highlighter, but it needs more on top to complete the package. It can be used for anything that requires awareness of code structure in an editor.

Re: Arborium: Tree-sitter code highlighting with Native and WASM targets

#18
post #17

Earlier quoted context omitted.

It's a Rust library (comprised of a bunch of crates) that wraps a high-performance, high-accuracy syntax highlighter (called Tree-sitter) with vetted support for almost 100 programming/markup languages. You can use it as a normal Rust library, or you can use the JavaScript/WASM wrapper to highlight source code on a web page.

> high-accuracy syntax highlighter (called Tree-sitter) Just wanted to note that tree-sitter is lower-level and more general: it's an incremental parser that is specialised for gracefully and efficiently parsing partially-correct code snippets or code being edited live. It's an important building block of the highlighter, but it needs more on top to complete the package. It can be used for anything that requires awar…

Thanks for the correction!

Re: Arborium: Tree-sitter code highlighting with Native and WASM targets

#19
I've been toying around with tree-sitter and have seen the potential for a proper, non-regex based highlighter. It's really powerful because it actually parses the text into an AST. With the AST it's possible for example to make variables the same colour everywhere. A function passed as a parameter could be highlighted as a function even in the parameter list.

I'm happy to see that tree sitter highlighting on the web is finally a thing. This seems really solid although the bundle size is a lot.

Re: Arborium: Tree-sitter code highlighting with Native and WASM targets

#20
post #12
post #10

https://fasterthanli.me/articles/my-gift-to-the-rust-docs-te... is a better link (the author's article about this rather than the artifact produced)

What a genius this dev is. Just a few weeks ago I tried to do something very similar for my blog, but quickly gave up as it’s not easy to do! Kudos to the author, they did an awesome job and went beyond by actually fixing up even the grammars and highlighting queries so it all works perfectly!

I agree! Not only do they write engaging blog posts, they also produce engaging videos!

https://youtube.com/@fasterthanlime

Post reply on HN