Skip to content

Commit

Permalink
Merge pull request #1 from knsv/master
Browse files Browse the repository at this point in the history
Update from master
  • Loading branch information
bjowes committed Dec 13, 2014
2 parents 28f6b93 + 2859413 commit 71fd8e1
Show file tree
Hide file tree
Showing 41 changed files with 36,676 additions and 3,622 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules/*
node_modules/*
bower_components/
11 changes: 8 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
language: node_js
node_js:
- "0.10"
language: node_js
node_js:
- "0.10"
addons:
code_climate:
repo_token: e87e6bf1c253e0555437ebd23235fdfe2749b889358e7c6d100e4ea5b4f2e091
after_script:
- cat coverage/lcov.info | codeclimate
68 changes: 68 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# How to contribute

Great that you want to be involved in this project! Contributing is fun and contributions are GREAT! :)

This page is currently a starting point is not so rigorous to start with.

Some important guidlines:

* The work will be organized using the issues list
* In the list there will be the bugs/enhancements etc we are working with in the project
* There will be milestones outlineing the roadmap ahead
* There will issues marked with help wanted

The issue list and the items marked with **help wanted** is a good starting point if you want to do some work.

## Guidelines for avoiding duplicate work

Contributing is great. It is not so fun when you are done with your issue and just before you're about to push your
change you cant because someone else just pushed the same fix so you have wasted your time. The guidelines below are in
place to prevent this:

* Comment in the issue that you are working on it. You will then be added as an assignee (eventually).
* When you pick an issue to work on.
* Check that the issue not assigned
* Also check the comments so that no one has started working on it before beeing officially assigned.


## Submitting changes
Please send a GitHub Pull Request with a clear list of what you've done (read more about pull requests). When you send
a pull request, we will love you forever if you include jasmine tests. We can always use more test coverage.

Always write a clear log message for your commits. One-line messages are fine for small changes, but bigger changes should look like this:

$ git commit -m "A brief summary of the commit
>
> A paragraph describing what changed and its impact."
Coding conventions
Start reading our code and you'll get the hang of it. We optimize for readability:

This is open source software. Consider the people who will read your code, and make it look nice for them. It's sort of
like driving a car: Perhaps you love doing donuts when you're alone, but with passengers the goal is to make the ride as
smooth as possible.

So that we can consistently serve images from the CDN, always use image_path or image_tag when referring to images.
Never prepend "/images/" when using image_path or image_tag.
Also for the CDN, always use cwd-relative paths rather than root-relative paths in image URLs in any CSS. So instead of
url('/images/blah.gif'), use url('../images/blah.gif').

# Build instructions
Fork, then:

```
npm install
```

Then the dependencies will have been installed. You use gulp as build tool.

The following targets are probably interesting:

* jison - compiles the jison grammars to parser files
* jasmine - runs the jasmine tests (will trigger the jison target)
* dist - complies files to the dist catalog

for instance:
```
gulp jasmine
```
Thanks, Knut Sveidqvist
74 changes: 72 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ would render this lovely chart:

![Example 1](http://www.sveido.com/mermaid/img/ex1.png)


A page with a live example can be seen [here](http://www.sveido.com/mermaid/demo/html/web.html). You can also look at mermaid in action using [jsbin](http://jsbin.com/faxunexeku/1/edit?html,output). If you want a live demo, there is aan editor provided in mermaid the mermaid project or you can simply look at this [great editor](http://danielmschmidt.github.io/mermaid-demo/)
#Installation

Either use the bower package manager as per below:
Expand Down Expand Up @@ -141,6 +141,21 @@ id1(This is the text in the box);

![Node with round edges](http://www.sveido.com/mermaid/img/ex7.png)

### A node in the form of a circle
```
id1((This is the text in the box));
```

![Node with round edges](http://www.sveido.com/mermaid/img/ex12.png)

### A node in an asymetric shape
```
id1>This is the text in the box];
```

![Node with round edges](http://www.sveido.com/mermaid/img/ex13.png)


### A node (rhombus)
```
id1{This is the text in the box};
Expand Down Expand Up @@ -218,5 +233,60 @@ A---|This is the text|B;

![Text on links](http://www.sveido.com/mermaid/img/ex11.png)

### Styling links
It is possible to style links, for instance you might want to style a link that is going backwards in the flow. As links
has no ids in the same way as nodes, some other way of deciding what link the style should be attached to is required.
Instead of ids the order number of when the link was defined in the graph is used. In the example below the style
defined in the linkStyle statement will belong to the forth link in the graph:

```
linkStyle 3 stroke:#ff3,stroke-width:4px;
```

## Interaction

It is possible to bind a click event to a node:

```
click nodeId callback
```

* nodeId is the id of the node
* callback is the name of a javascript function defined on the page displaying the graph, the function will be called with the nodeId as parameter.

## Usage of the parser as a seperate module

### 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();
```

The parser is also exposed in the mermaid api by calling:
```
var parser = mermaid.getParser();
```
Note that the parse needs a graph object to store the data as per:
```
flow.parser.yy = graph;
```

Look at graphDb.js for more details on that object.
# Credits
Many thanks to the [d3](http://d3js.org/) and [dagre-d3](https://github.com/cpettitt/dagre-d3) projects for providing the graphical layout and drawing libraries!!!
Many thanks to the [d3](http://d3js.org/) and [dagre-d3](https://github.com/cpettitt/dagre-d3) projects for providing the graphical layout and drawing libraries! Thanks also to the [js-sequence-diagram](http://bramp.github.io/js-sequence-diagrams) project for usage of the grammar for the sequence diagrams.

*Mermaid was created by Knut Sveidqvist for easier documentation.*
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mermaid",
"version": "0.2.4",
"version": "0.2.15",
"authors": [
"knsv <[email protected]>"
],
Expand Down
15,850 changes: 14,573 additions & 1,277 deletions dist/mermaid.full.js

Large diffs are not rendered by default.

9 changes: 6 additions & 3 deletions dist/mermaid.full.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit 71fd8e1

Please sign in to comment.