@bramus that's actually the exact thing that I want to implement (for some time). I also couldn't find any reasons except some comments confirming that inputs/textareas don't work 😢
Top-level
@bramus that's actually the exact thing that I want to implement (for some time). I also couldn't find any reasons except some comments confirming that inputs/textareas don't work 😢 4 comments
@pygy @cheeaun Perfectly possible. Here's a demo that does on-the-fly highlighting: https://www.bram.us/2024/02/18/custom-highlight-api-for-syntax-highlighting/#highlighting-contenteditable That makes LDT redundant... Prism is ~10Kb larger, but its parsing abilities is heaps and bounds better than what LDT offers with just regexps. Prism also supports styling the content of script and style tags in HTML, out of the box... |
@cheeaun @bramus I was thinking of hacking something for textarea based on https://github.com/kueblc/LDT
(which overlays a transparent <textarea> on top of a styled <pre>)
Not sure the highlight API has been thought out for dynamic content... I don't know if you can change the bounds of a range after it's been registered and have the output updated... We'll see 🙂