mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-20 07:49:43 +02:00
Fix for br tags within nodes for new line
This commit is contained in:
16
src/main.js
16
src/main.js
@@ -2,6 +2,8 @@ var graph = require('./graphDb');
|
||||
var flow = require('./parser/flow');
|
||||
var utils = require('./utils');
|
||||
var seq = require('./sequenceRenderer');
|
||||
var he = require('he');
|
||||
|
||||
/**
|
||||
* Function that adds the vertices found in the graph definition to the graph to be rendered.
|
||||
* @param vert Object containing the vertices.
|
||||
@@ -57,6 +59,7 @@ var addVertices = function (vert, g) {
|
||||
|
||||
// Create the node in the graph based on defined form
|
||||
if (vertice.type === 'round') {
|
||||
console.log(verticeText);
|
||||
g.setNode(vertice.id, {labelType: "html",label: verticeText, rx: 5, ry: 5, style: style, id:vertice.id});
|
||||
} else {
|
||||
if (vertice.type === 'diamond') {
|
||||
@@ -226,18 +229,21 @@ var init = function () {
|
||||
id = 'mermaidChart' + cnt;
|
||||
cnt++;
|
||||
|
||||
var chartText = element.textContent.trim();
|
||||
var txt = element.innerHTML;
|
||||
txt = txt.replace(/>/g,'>');
|
||||
txt = txt.replace(/</g,'<');
|
||||
txt = he.decode(txt).trim();
|
||||
|
||||
element.innerHTML = '<svg id="' + id + '" width="100%">' +
|
||||
'<g />' +
|
||||
'</svg>';
|
||||
|
||||
if(utils.detectType(chartText) === 'graph'){
|
||||
draw(chartText, id);
|
||||
if(utils.detectType(txt) === 'graph'){
|
||||
draw(txt, id);
|
||||
graph.bindFunctions();
|
||||
}
|
||||
else{
|
||||
seq.draw(chartText,id);
|
||||
seq.draw(txt,id);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -253,7 +259,7 @@ exports.version = function(){
|
||||
}
|
||||
|
||||
var equals = function (val, variable){
|
||||
if(typeof variable !== 'undefined'){
|
||||
if(typeof variable === 'undefined'){
|
||||
return false;
|
||||
}
|
||||
else{
|
||||
|
Reference in New Issue
Block a user