Post
highlight.js is fairly resilient to ReDoS, but even so we'd occasionally have to field some security reports about it. Tree-sitter is not immune to DoS either, but we can tune it to protect against DoS in ways that aren't possible with RegEx.
0 reposts8 likes
Shout-out to the tree-sitter contributors and the hundreds of independent grammar authors for creating such a strong ecosystem, and shout-out @fasterthanli.me for building Arborium (the basis for our new syntax highlighter).
If you want to check out the source code, it's available at github.com/discord/arbo.... Your favorite language may not be supported, but please feel free to submit a patch with new grammars: they need only be permissively licensed.
github.comGitHub - discord/arborium-rt: tree-sitter syntax highlighting for the browser and Electrontree-sitter syntax highlighting for the browser and Electron - discord/arborium-rt