How to create an textarea that supports Syntax-Highlighted code?

578 views
Skip to first unread message

fu6...@gmail.com

unread,
Oct 18, 2021, 1:00:07 AM10/18/21
to Blockly
Hi,
How to create an textarea that supports Syntax-Highlighted code?

Thank you.

Aaron Dodson

unread,
Oct 18, 2021, 11:38:29 AM10/18/21
to Blockly
Hi,

That editor in the advanced playground uses the Monaco editor. CodeMirror is another popular library for syntax highlighting that may work well for you. If you want to have a block that allows directly editing code with syntax highlighting, the documentation on custom blocks and fields is a good place to start. Hopefully that helps some!

- Aaron

Neil Fraser

unread,
Oct 18, 2021, 1:11:02 PM10/18/21
to blo...@googlegroups.com
ACE is also a good editor.  Generally speaking I prefer CodeMirror over ACE, unless good support for touchscreen devices is important, in which case ACE wins (for now, CodeMirror is catching up fast).

--
You received this message because you are subscribed to the Google Groups "Blockly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blockly+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/blockly/33d1e36e-b9a6-4030-aa9a-b27ed0f95886n%40googlegroups.com.


--

fu6...@gmail.com

unread,
Oct 18, 2021, 1:49:21 PM10/18/21
to Blockly
Hi,  Aaron and  Neil.
Thank you for your advice. I have successfully used the monaco editor on my project. I will try to use different editors later.
1.PNG
Reply all
Reply to author
Forward
0 new messages