Another update this now has grid lines, rectangles as output, triangles as input and better naming of nodes (added some logic for better label texts). Also centred the text for nodes that become higher with multiple outputs.
Maybe just let the user decide and make this optional. You could then have a "standard flow viewer", which aims to be an exact copy of the Node-RED editor view and an "advanced flow viewer", with new fancy stuff.
You did an amazing job and I really want to play with this. Our goal is to integrate the viewer in our cloud system. No more importing into Node-RED to see what this bloody flow does
This is certainly something we've long wanted to do - a lot of my personal inertia on it has been due the issues around getting the colours/labels/icons right.
Are you at all interested in contributing this back into the node-red org on github where we can develop it into a properly reusable component? I know you'd expressed some reservations on doing that yourself earlier in the thread.
We'd want to make sure the appearance is consistent with Node-RED by default - so things like the arrow heads (a topic often discussed and even prototyped but never quite got over the line), could be an option that you can enable, but would be off by default.
I've been playing around with the language specification in the code fencing block (i.e. the backticks) and unfortunately there isn't a standard way of passing options to plugins, e.g.
The jQuery selector I use is $('.language-noderedjson') so that would break. Using spaces causes everything after the language to be ignored... markdown was never designed for this
So making that happen would be globally, i.e., when including the javascript into the page.
Thank you, much appreciate Please do play around with it and tell me how it goes!
I'd be most happy with having it included within Node-RED, after all that's where it should be!
I have reservations on making it into a mini-editor window, i.e., making it too interactive. But that's just my thinking that I'd prefer to keep it simple so that people who have no experience with Node-RED can get an appreciation for Node-RED. My target audience is exactly those that are interested but have no experience with Node-RED, hence I would like it to be as clear and understandable as possible.
The arrow heads was an idea to facilitate understanding and clarity - as I said, a static image isn't an editor so that makes it difficult to transport knowledge. (json = one long word, image = one thousand words, an editor = ten thousand words!).
But I know that the Node-RED team definitely has an eye for UI, so I am sure that there will a great solution to make everyone happy
I've definitely cut corners (e.g. no slightly-thicker-white line under the grey line!) and explicitly didn't make an exact copy since I wanted to have a prototype before spending that 80% of my time doing the final 20% of the job!
My goal is to bring Node-RED to broader audience and not to build the ultimate flow viewer
Hm, nothing - just the js & css includes and at the bottom of the page the script snippet ...
If you're not using markdown, then you need a code block with class language-noderedjson.
it basically goes looking for $('code.language-noderedjson'); and replaces those elems.
What I do is generate markdown in Node-RED, then use the markdown node to get html and then I push that html into a html template.
So I have a specific setup whereby I generate markdown that goes into a html template and I control the entire pipeline ...
UPDATE: Mea Culpa!
the jquery src is wrong, it should be https://blog.openmindmap.org/content/jquer...... it's a relative url in your screenshot - I've updated the page with the details to have the correct url
I've updated the example page with new languages, so now the noderedjson does as near as possible the default editor view, ie., rectangles + gridlines. noderedjson-with-arrows does input triangles but rectangles for outputs, noderedjson-no-gridlines removes the gridlines and noderedjson-no-gridlines-with-arrows needs not explanation.
But on that page I use noderedjson-with-arrows - after all, I like triangles!
if you're using the -v7. js and css files then you can't, need to be using the flowviewer.js and css. Then its the default noderedjson language that is as close as possible to the editor.
Another update with better handling of rendering options: order is no longer a requirement, i.e. noderedjson-with-arrows-no-gridlines is the same as noderedjson-no-gridlines-with-arrows.
There is new option with-zoom which makes the image zoomable and pannable. Your mileage might vary on mobile but a double-click resets the image back to the original settings. Options are mix and matchable.
That thought never, ever, not-even-once, really-never crossed my mind
Btw2: Here is another thought I might (or might not) have had: a diff viewer - obviously a very contrived example. Use the slider to blend between two versions of the same flow. Obviously this won't help with function nodes or anything that had content changes but visual changes can easily be identified.