Fix for issue #259

This commit is contained in:
knsv
2015-11-22 18:53:09 +01:00
parent 989ff03e43
commit a9f4f8e06c
4 changed files with 49 additions and 54 deletions

View File

@@ -29798,7 +29798,8 @@ var config = {
return d.getMonth();
}]]
},
classDiagram: {}
classDiagram: {},
info: {}
};
Logger.setLogLevel(config.logLevel);
@@ -30023,18 +30024,21 @@ var render = function render(id, txt, cb, container) {
};
exports.render = function (id, text, cb, containerElement) {
log.info('APA');
if (arguments.length === 1) {
text = id;
id = 'mermaidId0';
}
if (typeof document === 'undefined') {
// Todo handle rendering serverside using phantomjs
} else {
// In browser
return render(id, text, cb, containerElement);
try {
if (arguments.length === 1) {
text = id;
id = 'mermaidId0';
}
if (typeof document === 'undefined') {
// Todo handle rendering serverside using phantomjs
} else {
// In browser
return render(id, text, cb, containerElement);
}
} catch (e) {
log.warn(e);
}
};
var setConf = function setConf(cnf) {

View File

@@ -232,7 +232,8 @@ var config = {
}]
]
},
classDiagram:{}
classDiagram:{},
info:{}
};
Logger.setLogLevel(config.logLevel);
@@ -475,18 +476,22 @@ var render = function(id, txt, cb, container){
};
exports.render = function (id, text, cb, containerElement) {
log.info('APA');
if(arguments.length === 1){
text = id;
id = 'mermaidId0';
}
try{
if(arguments.length === 1){
text = id;
id = 'mermaidId0';
}
if (typeof document === 'undefined') {
// Todo handle rendering serverside using phantomjs
}
else {
// In browser
return render(id, text, cb, containerElement);
if (typeof document === 'undefined') {
// Todo handle rendering serverside using phantomjs
}
else {
// In browser
return render(id, text, cb, containerElement);
}
}catch(e){
log.warn(e);
}
};

View File

@@ -19,6 +19,9 @@ graph LR;
A-->B;
B-->C;
</div>
<div class="mermaid">
info
</div>
<div class="mermaid">
sequenceDiagram
Merchant->>Customer: foo

View File

@@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="../dist/mermaid.forest.css"/>
<script src="../dist/mermaid.min.js"></script>
<script src="../dist/mermaid.js"></script>
<script>
var config = {
startOnLoad:true,
@@ -47,7 +47,7 @@
click A coolAction
B --> D{Rhombus}
C --> D
A("test(vcc) a a ") --> B;
A("test(vcc) a a ") --> B
snda
</div>
@@ -156,8 +156,9 @@
c1-->a2
</div>
<div class="mermaid" >graph TB
subgraph
<div class="mermaid">
graph TB
subgraph Tjo
sq[Square shape] -.-> ci((Circle shape))
od>Odd shape]-. Two line<br>edge comment .-> ro
di{Diamond with <br/> line break} ==> ro(Rounded<br>square<br>shape)
@@ -183,12 +184,11 @@
sq[Square shape]-->ci((Circle shape))
od>Odd shape]---|Two line<br>edge comment|ro
end
subgraph
od2>Really long text in an Odd shape]-->od3>Really long text with linebreak<br>in an Odd shape]
di{Diamond is broken}-->ro(Rounded squar shape);
di-->ro2(Rounded square shape)
end
subgraph dfdg
od2>Really long text in an Odd shape]-->od3>Really long text with linebreak<br>in an Odd shape]
di{Diamond is broken}-->ro(Rounded squar shape)
di-->ro2(Rounded square shape)
end
</div>
<div class="mermaid">
graph LR;
@@ -201,30 +201,13 @@
C-->|XYZ Router|D;
</div>
<h1>Sequence diagrams (experimental)</h1>
<pre>
sequenceDiagram
participant John the Long
Alice->Bob: Hello Bob, how are you?
Note left of Bob: Bob thinks
Bob-->Alice: I am good thanks!
Bob-->John the Long: How about you John?
Note left of John the Long: Bob thinks
Bob-->Alice: Checking with John...
loop Multiple status checks
loog Naging
Alice->John the Long: Yes... John, how are you?
end
John the Long-->Alice: Better then you!
end
</pre>
<div class="mermaid2">
<h1>Sequence diagrams </h1>
<div class="mermaid">
sequenceDiagram
participant Alice
Note left of Alice: Bob thinks about <br/> things <br/> to think about
</div>
<div class="mermaid2">
<div class="mermaid">
sequenceDiagram
participant Alice
participant Bob