Prettify - using textarea instead of pre tag?

981 views
Skip to first unread message

Alexander

unread,
Apr 22, 2015, 12:07:11 PM4/22/15
to js-code-p...@googlegroups.com
Hi,

I have the source code inside an textarea tag. But syntax highlighting just work with pre, code or xmp tag.

Which place must be edited, that highlighting also works with the textarea tag?

Regards Alex

Mike Samuel

unread,
Apr 22, 2015, 12:34:33 PM4/22/15
to js-code-p...@googlegroups.com
Unfortunately, prettify works by taking text and adding formatting elements.

<textarea> tags can't contain elements -- only the text to edit, so
their content can't be prettified.

There are other projects out there that implement syntax-highlighting
code editors in JavaScript.

I would look for projects using:
syntax highlighting
code editor
content editable

http://stackoverflow.com/questions/1619167/textarea-that-can-do-syntax-highlighting-on-the-fly
seems relevant though I can't endorse any particular answer since I
have little experience with any of these libraries.
> --
> You received this message because you are subscribed to the Google Groups
> "js-code-prettifier" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to js-code-prettif...@googlegroups.com.
> To post to this group, send email to js-code-p...@googlegroups.com.
> Visit this group at http://groups.google.com/group/js-code-prettifier.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages