Загрузка видео...

Не удалось загрузить видео

На главную

💡 Universal syntax highlighter. In a <textarea> In 2026 (Chrome 152+), you can syntax-highlight different programming languages within the same <textarea> and get decent results Using the 🆕 OpaqueRange web API Works for <textarea>, even <input> Demo:

67,134 просмотров • 5 дней назад •via X (Twitter)

Комментарии: 12

Фото профиля Seb ⚛️ ThisWeekInReact.com
Seb ⚛️ ThisWeekInReact.com5 дней назад

Afaik the original demo uses <pre contenteditable="plaintext-only"> + Range + CSS Custom Highlights But we can now syntax-highlight <textarea> + <input> too, using OpaqueRange Check @hypeddev article for more details here:

Фото профиля Seb ⚛️ ThisWeekInReact.com
Seb ⚛️ ThisWeekInReact.com5 дней назад

My demo is entirely vibe-coded; I just had the idea to give it a try Astra coded this and improved it from the original demo: highlights do not erase as you type

Фото профиля Sébastien Chopin
Sébastien Chopin5 дней назад

This is amazing, finally!

Фото профиля Seb ⚛️ ThisWeekInReact.com
Seb ⚛️ ThisWeekInReact.com5 дней назад

Yes! Seems like the lightweight future of syntax highlighting. The model is already quite nice for an experiment

Фото профиля Jan Nicklas
Jan Nicklas5 дней назад

would it be possible to train the model in a way that it supports mixing different languages? e.g. here the css highlighting is quite random:

Фото профиля Seb ⚛️ ThisWeekInReact.com
Seb ⚛️ ThisWeekInReact.com4 дней назад

I don't know, question for @shuding How does it behave with the same Css without mixing it?

Фото профиля Vlad Sazonau
Vlad Sazonau5 дней назад

@hunghg255 Wow 😮

Фото профиля Sung Leveling
Sung Leveling5 дней назад

Somebody get this on Github Issues and PRs

Фото профиля Joulse
Joulse5 дней назад

Textarea finally catching up to what editors already do

Фото профиля Sebastian Buzdugan
Sebastian Buzdugan4 дней назад

how stable are gpu-lexer token classes between edits? color flicker matters more than speed

Фото профиля Ben Mo
Ben Mo4 дней назад

I'll take native selection and undo with a bit of syntax colour for a small code field any day

Фото профиля Buswe
Buswe5 дней назад

Best part is you keep the native undo stack and spellcheck, which the old overlay-div highlighting trick always gave up.

Похожие видео