12765 shaares
320 private links
320 private links
A 16KB alternative to Prism and highlight.js: https://github.com/j9t/syntaxp
How It Works
- Finds all
<code>elements with aclass=language-*attribute- Tokenizes the text content using regex-based per-language tokenizers
- Creates StaticRange objects for each token
- Registers them as Highlight objects in CSS.highlights
- Styles them via
::highlight()CSS rules