Skip to content
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

Provide parser as separate module #4

Closed
RangerMauve opened this issue Nov 29, 2014 · 8 comments · Fixed by #4727
Closed

Provide parser as separate module #4

RangerMauve opened this issue Nov 29, 2014 · 8 comments · Fixed by #4727

Comments

@RangerMauve
Copy link

I really like the syntax you've made, and I think it could have applications outside the graph rendering stuff. It'd be nice if you provided a parser for the graph itself as a separate module.

@knsv
Copy link
Collaborator

knsv commented Nov 30, 2014

Thanks!

The parser is available in the module 'parser/flow' and the data extracted from the text is stored in the graph object. So you can use the parser without rendering the graph as outlined below. Was it something like that you had mind?

Setup

var graph = require('./graphDb');
var flow = require('./parser/flow');
flow.parser.yy = graph;

Parsing

flow.parser.parse(text);

Data extraction

graph.getDirection();
graph.getVertices();
graph.getEdges();

@knsv knsv closed this as completed Nov 30, 2014
@knsv knsv reopened this Nov 30, 2014
@RangerMauve
Copy link
Author

Yes, actually. Thanks!

Would it also be possible to add this to the docs somewhere for future inquirers?

bjowes added a commit that referenced this issue Jan 14, 2015
@KarolisKaj
Copy link

Sorry for bringing it up after such a long time but I believe answer is a bit outdated. Would it be possible to provide an up to date example of extracting object graph of mermaid code, as it was originally requested in this post?

@tylerlong
Copy link
Collaborator

tylerlong commented Mar 16, 2018

The code is still pretty correct except you need to adjust the require statements because files has been moved.

@KarolisKaj
Copy link

@tylerlong Thanks for you reply. I have managed to make it work :)

@Sigfried
Copy link

Sigfried commented Mar 26, 2018

I had to change import graph from 'mermaid/src/diagrams/flowchart/graphDb to import graph from 'mermaid/src/diagrams/flowchart/flowDb

knsv pushed a commit that referenced this issue Dec 11, 2019
knsv pushed a commit that referenced this issue Dec 23, 2019
knsv pushed a commit that referenced this issue Aug 4, 2021
Bumps [actions/cache](https://github.com/actions/cache) from 2.1.5 to 2.1.6.
- [Release notes](https://github.com/actions/cache/releases)
- [Commits](actions/cache@v2.1.5...v2.1.6)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@GullyBurns
Copy link

Hi.

I'm trying to use the parser as a way to specify a flowchart that I'd like to process as a graph in a downstream app. I'm trying to figure out how to access this within the current codebase and it looks like it's impossible.

Can anyone provide an indicator about how we might be able to do this?

Thanks!

Gully Burns

@SuperCuber
Copy link

@knsv I'm also interested in this. How would I import this from a yarn project?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
7 participants