Would it be possible to have more languages supported in syntax highlight within the template node (Python for example...) ?
How could we make this easily configurable ?
Thanks !
Would it be possible to have more languages supported in syntax highlight within the template node (Python for example...) ?
How could we make this easily configurable ?
Thanks !
Hi Matieu,
Wanted to post a related question this week. We want to have SVG syntax in the ACE editor of our new node (which is based on the Template node code), but get an error when we specify 'svg'. Not sure whether we are using it incorrectly, or Node-RED only supports a limited set of syntaxes (html, javascript...).
Bart
Yes currently we only support a few syntax highlighters to try to save space, but are going to relax that and install the complete default set for 1.0.. Would have to check if that includes svg. We wouldn't add them all to the template node, but they would be available to custom nodes.
This directory in the Node-RED repo gives a brief overview of all supported ACE modes.
There is a mode file for Python, so it should already be supported. It isn't included in the selection list of the template node, though.
Yes it was added so that contributed python node could use it.
That would be greatly appreciated.
I think so - looks same as these - https://github.com/ajaxorg/ace-builds/tree/master/src
Well maybe not all all - but a lot more... not sure we really need 1MB for php etc
Maybe a way to add custom ones? Then people could add odd ones if they needed to.
Another API to maintain ? No thanks
(Especially when you may not want ACE editor anyway...)
Just a folder, I wouldn't expect to need another API.
But you would need to "convince" ACE to load it from a different location.
Isn't it all served from a web server? If so, it is trivial to add another folder to a URL. I make good use of that with uibuilder.
Bear in mind though that I don't know the guts of how ACE works so it might not be that easy. But if it is easy, it would be very helpful indeed. Not only would it let the NR core stay lean but it would make NR's use of ACE super flexible.
It is, serving the files would be the easy part.
I meant the ACE part. AFAIR there is this setMode()
function on the editor session which takes a string of the mode's name. I think the magic to resolve this into an URL call happens inside the ACE library.
I do not know if you can pass an URL directly to setMode()
. If so, it would be really easy to add new modes.
The point is that you don't need another URL, only another folder accessible to the web server
ExpressJS allows you to add multiple folders to a single URL if you are serving static files. This would have to happen at Node-RED startup but that is normal.
If there is a complexity it would be around discovery of the mode name. Most nodes (all?) that use the ACE editor have, I think, a manual list of mode names. Still, you could still use this with custom nodes very easily.
What
Is
ACE ?
It's the editor component used for function nodes, templates, etc.
@dceejay on a related note to SVG support, I have noticed on editing JSON syntax in Node-RED TypedInputs that there is a "Format JSON" button.
Would you know if the library that performs this "pretty print" operation supports SVG/XML/HTTP?
As you know @BartButenaers and I are working on an SVG node & along with syntax support, we hope to add a similar "Format SVG" feature but before we import another LIB, we wondered if there is either something built in to Node-RED, or something that would/could be added when additional language support is added for ACE?
Thanks.
Not sure. I know @knolleary sweated days on that.
It uses the standard JSON.stringfy to do it - no library involved.
But this is nothing to do with the topic of the thread, so if you want to ask more, please use a new topic.