I want a simple real-time syntax highlighting in a tinyMce editor.
I want to highlight (change background or color of the text) for every #{keyword}
and #{more keywords}
in the text. Keyword can only contain letters, numbers and dots (.).
I don't know if my idea is good:
- bind to onChange event of the editor
- remove all occurrences of
<span class="code">#{keyword}</span>
(regex) - find all #{keyword} and replace them with #{found keyword}
(css class code
would have background set to some color)
Any ideas how to solve this problem?