If you want to know the details: did a full write up on this one: https://www.bram.us/2024/02/18/custom-highlight-api-for-syntax-highlighting/
Also comes with an extra demo that syntax highlights the code in a [contenteditable] as you type.
Top-level
If you want to know the details: did a full write up on this one: https://www.bram.us/2024/02/18/custom-highlight-api-for-syntax-highlighting/ Also comes with an extra demo that syntax highlights the code in a [contenteditable] as you type. 2 comments
|
@bramus It’s interesting that this new approach prevents you from using many CSS features.
I’m using Highlight.js to syntax-highlight code for LaTeX (to produce PDFs from Markdown). And I had to look up sequences of CSS class names in CSS files to get color, text weight, etc. That’s what you need to do here, too.
It’s a shame there is no declarative (non-JS) version of this API.