Easy syntax coloring/highlighting?

Hi, I’m creating an interface with FeathersUI that will handle some texts. Some of these texts will be formatted as CSS and some as JSON. I was looking for ways to implement some code highlighting to it (just coloring, no need for completion functionality) and found out about the Moonshine code editor (Moonshine IDE's code editor powered by Feathers UI - Feathers UI), but I didn’t quite understood some of the examples, and also dindn’t find somethins specific about JSON. Are there any other resources out there to understand it better?

Thank you a lot!

Sorry, got it from this example: https://github.com/Moonshine-IDE/moonshine-feathersui-text-editor/tree/master/samples/simple-text-editor

I was looking at the “wrong” ones…

As you probably saw in the simple-text-editor sample that you found, you can syntax highlight JSON by treating it as JavaScript (since JSON is a strict subset of JavaScript). So that means using JSSyntaxFormatBuilder.

There isn’t really any documentation for the TextEditor component, except what you can see in the doc comments embedded in the code. If you have any questions, feel free to ask here.

Yeap, I saw it on the example. It is working nicely for JSON right now. Thank you a lot!
Great work on that (and everything else)! You know you (and othe OpenFL guys) are a genius, right? :wink:

2 Likes