Closed Semmu closed 3 years ago
Looks nice!
I just published 0.7.1
where the file reading logic is exposed as nomnoml.compileFile(path, maxDepth, 0)
You could depend on this directly, would probably be nicer than duplicating the logic.
Fair point, but my implementation is a bit different: it is not too strict about whitespaces (so you can format your code better when importing stuff inside a nested block), and also it does not throw an exception when the import depth limit is reached or the file to be imported is not found, rather it displays colored "end" visuals. I have some examples here: https://github.com/Semmu/nomnoml-watch/tree/master/tests
And the implementation is here: https://github.com/Semmu/nomnoml-watch/blob/master/nomnoml-watch.js#L12
I also want to make it even more robust by being able to parse multiple import directives on one line, but that may be unnecessary over-engineering and also a feature which breeds bad practices. I don't know.
Btw. I see now the browser version supports multiple "files" in localStorage, pretty cool! Also maybe adding a HTTPS cert. would be useful, IIRC browsers will soon mark sites unsafe if they are served over plain HTTP.
I see :)
Would love to get some feedback from real-world usage of the #import
directive and how it works.
Please do try the "multiple files", I am quite happy with that feature :D
I just had a new idea. Since my thing watches nomnoml files and it also supports importing, it would make sense to build a dependency/import graph between the files, so when a file changes, the tool also re-renders all the files which include the changed one. I think this is a feature that should be elementary.
But now the problem is that my implementation will get vastly different from yours and I'm not sure how/where we should store all this logic - code duplication is obviously not a great solution.
What do you think?
Develop all the logic that you need. I coded the cli-stuff mostly on a whim, if external utilities offer CLI features in a better way than nomnoml itself can, then that is a good thing.
Happy to announce that nomnoml can now served over HTTPS.
Hi,
This is not an issue or feature request per se, I just want to mention that I created a separate npm/npx package to compile nomnoml diagrams locally whenever needed, basically replicating what the website does.
It is available here: https://www.npmjs.com/package/nomnoml-watch And you can run it with
npx nomnoml-watch
.It is not a big thing, but do you think it is worth mentioning in your README?