Textarea that can do syntax highlighting on the fly?

Pekka picture Pekka · Oct 24, 2009 · Viewed 179.4k times · Source

I am storing a number of HTML blocks inside a CMS for reasons of easier maintenance. They are represented by <textarea>s.

Does anybody know a JavaScript Widget of some sort that can do syntax highlighting for HTML within a textarea or similar, while still staying a plain text editor (no WYSIWYG or advanced functions)?

Answer

Nickolay picture Nickolay · Oct 24, 2009

It's not possible to achieve the required level of control over presentation in a regular textarea.

If you're OK with that, try CodeMirror or Ace or Monaco (used in MS VSCode).

From the duplicate thread - an obligatory wikipedia link: http://en.wikipedia.org/wiki/Comparison_of_JavaScript-based_source_code_editors