M
Micheal Nestor
Guest
Micheal Nestor Asks: Best solution for live custom syntax highlighting in react?
I am currently trying to create react component where you enter text, and individual words are coloured based on rules set by me. For example all words that are longer then 7 chars should be blue, else red. I currently have a fully working, input and output components side by side (This works by parsing the text inputted and generating a set of spans with different color attributes, and putting them in the output). But it would be perfect if I could combine them. Looking around I think I might be able to use a Rich text editor like prismjs or lexical, however these seem like overkill imo. So I thought I would ask here first and see if anyone had some good ideas <3.
I am currently trying to create react component where you enter text, and individual words are coloured based on rules set by me. For example all words that are longer then 7 chars should be blue, else red. I currently have a fully working, input and output components side by side (This works by parsing the text inputted and generating a set of spans with different color attributes, and putting them in the output). But it would be perfect if I could combine them. Looking around I think I might be able to use a Rich text editor like prismjs or lexical, however these seem like overkill imo. So I thought I would ask here first and see if anyone had some good ideas <3.