skanaar / nomnoml

The sassy UML diagram renderer
https://www.nomnoml.com
MIT License
2.66k stars 208 forks source link

iOS Diagram #182

Closed zeltas closed 1 year ago

zeltas commented 1 year ago

Hello, is there way to launch nomnoml from a Xcode app and pass a script as a variable to create diagram? The idea is to use code to create a script and load it by launching nomnoml.

skanaar commented 1 year ago

The nomnoml library can be used for that. It is a javascript library so you will need node or a WebView (or similar) to execute it.

Take a look at https://github.com/skanaar/nomnoml#svg-output-in-nodejs The nomnoml command line tool might also be good to look at: https://github.com/skanaar/nomnoml/blob/master/dist/nomnoml-cli.js

zeltas commented 1 year ago

Thank you for your assistance.

I installed nomnoml on Mac and using Safari the supplied HTML Canvas rendering code works OK. However, when using WKwebView, it doesn't reference the installed files at as Safari does:

`

` This could be the result of the sandbox issue. Attempts to locate these files physically to add them to the app directory has come up empty. Where are they exactly?

Attempts to physically add these two files (from GitHub) to the app directory hasn't worked either - ether that or they have additional dependences.

Is it possible to simply add these source files into a single HTML file as a single solution to address this issue?

I simply need to have [hello]->[world] rendered in the webView. It is possible, I know this, I just don't have any other direction or resources to go to. I'm 90% there but facing a wall. I just need someone to show me to point the jackhammer. As for using NodeJS - not familiar with that or how it would work with WKwebView.

Please help me.

Thank you

zeltas commented 1 year ago

It is my strong belief that if everything is in a single HTML file, WKwebView will be able to read and render it via:

var source = '[nomnoml] is -> [awesome]' nomnoml.draw(canvas, source)

skanaar commented 1 year ago

Download those files and add bundle them with your app. Should work. Or inline them in the html file.

But these things is not really associated with nomnoml so i can't help you more than this. But good luck!