-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Client utility for mermaid #6
Comments
Thats a good idea! It is in the scope now :) |
👍 |
👍 |
1 similar comment
👍 |
👍 .. really need it as a tool to generate diagrams quickly (: |
Will start with the node module today is in #7, consider this issue the mermaid utility. This one I would not mind help with if someone is interested. |
@knsv I'll take a look in a short while (: |
Sounds good! |
@knsv I've tried Doing development on Mac works fine. |
in the same spirit I made an attempt to generate a graph using phantomjs but so far I failed, it seems like mermaid is not properly run inside phantomjs and I don't undestand why :( |
Check if the execution mermaid.init has triggered. If not you can try to run in manually and see if svg rendering is done. |
My issue is that I can't find where the mermaid "class" is, in a browser I can find it at |
Just did a naïve test. I ran the script below which opens the test page using phantomjs and saved the result as a png:
When looking at the result, it is clear that mermaid started and rendered. That is good as it means there are not principal blockers for what we are trying to do. Whats your setup? |
Yes it looks likes the library itself have no issue with phantomjs, at least that's a start ^^ I tried to make my test simpler to find the problem seems to be with local files vs remote, here it is: page = require('webpage').create()
page.open 'file://test.html', () ->
page.render('/tmp/out.png')
phantom.exit() with this simple test: <!DOCTYPE html>
<html>
<head>
<script src="https://cdn.rawgit.com/knsv/mermaid/master/dist/mermaid.full.min.js"></script>
<meta charset="utf-8">
</head>
<body>
<div class="mermaid">
graph TD;
S[Start]-->L[Login];
L-->C{Connected};
C-->|No|W[Wait 5s];
W-->L;
C-->|Yes|G[Get Folders List];
G-->GE{Empty List};
GE-->|Yes|EN[End];
GE-->|No|LF[For each folder];
C-->|Toto|GE(tott);
</div>
</body> For me it renders the graph definition test itself xD |
Yeah. Also got into problems with a local file. After some meddling I found that my 1st issue was with the path. Using the full path is worked. Then some more meddling I had your exact symptoms replicated. The png as saved but with the text. In my case, not saying your setup had the same issue, but in my case I had moved files around and the path to mermaid was wrong from the directory where I tested. After a fix of the relative paths it worked. As a side note, could not get it work with file://web.html when the file was in the cwd but with ./web.html as in below it worked.
|
I put together a rudimentary implementation of Also, it's a bit of a mess as the implementation was hasty (so please ask if there are parts that don't follow!), but hopefully it gives a good idea of how this could be implemented; I'm performing everything within phantom itself, not loading any externally generated HTML files or the like, which seems ideal to me (no temporary files to clean up!). |
Hi fardog! I like what you have done and I think it should be in mermaid. The inclusion of phantomjs as a dependency is ok. We will want it for more automated tests anyway. If you do a pull request I will gladly merge this. It also goes hand in hand with other work that is ongoing to get the generated svgs to be browser independent so they can be opened in editor of choice. |
nice ! |
@knsv: sounds good; I'd like to finish cleaning things up and get some tests written and then I'll get this into a PR, however I'd like to discuss the inclusion of phantom a bit; I've been thinking about this on and off through the day: Since this'll be installed globally, phantom will have to be in
I think that (1) is a manageable option, although it's side-stepping the nice dependency resolution that npm does, which is less than ideal, and (2) is also good, so long as there's a maintainer for the Let me know what you think, I'm happy to take whatever approach you think works best, and will PR appropriately; I'll be working on this and hope to have tests written and be stable by this weekend; seeing that you're making improvements to the SVG text (#58) I won't concern myself with handling that CLI-side--I was writing code to replace the |
sorry, going to comment on my own message here, but I did some research this evening, and am going to recommend completely against (3): on some platforms (such as Solaris and Joyent SmartOS), installing phantomjs isn't supported and will fail completely; including it as a main dependency will cause |
Agree with you, 3 is out. I think 1 sounds like the best solution. Then the users that want to use the client utility can add phantomjs themselves. |
@knsv sounds good, and that's the implementation i'll be working on this weekend. hope to send you a PR by Sunday |
Great! |
Closed as of version 0.3.0 |
Bumps [webpack-cli](https://github.com/webpack/webpack-cli) from 3.3.12 to 4.7.2. - [Release notes](https://github.com/webpack/webpack-cli/releases) - [Changelog](https://github.com/webpack/webpack-cli/blob/master/CHANGELOG.md) - [Commits](https://github.com/webpack/webpack-cli/compare/[email protected]) --- updated-dependencies: - dependency-name: webpack-cli dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Would be sweet if I could just
$ npm install -g mermaid
and then$ mermaid flowchart.md
and it would save a png of the output. Is this in scope for this project?The text was updated successfully, but these errors were encountered: