Skip to content

Commit

Permalink
Draft of font-awesome support as described in issue #49.
Browse files Browse the repository at this point in the history
  • Loading branch information
knsv committed Oct 7, 2015
1 parent 16906ee commit ed65e6d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
6 changes: 6 additions & 0 deletions src/diagrams/flowchart/flowRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,15 @@ exports.addVertices = function (vert, g) {
verticeText = vertice.text;
}



var labelTypeStr = '';
if(conf.htmlLabels) {
labelTypeStr = 'html';
verticeText = verticeText.replace(/fa:fa[\w\-]+/g,function(s,t,u){
return '<i class="fa '+ s.substring(3)+'">&nbsp';
});

} else {
verticeText = verticeText.replace(/<br>/g, "\n");
labelTypeStr = 'text';
Expand Down
4 changes: 0 additions & 4 deletions src/mermaidAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,10 +303,6 @@ exports.encodeEntities = function(text){

});

//txt = txt.replace(/fa:fa[\w\-]+/g,function(s,t,u){
// return 'fa:¢';
//});

return txt;
};

Expand Down
8 changes: 4 additions & 4 deletions test/examples/fontAwesome.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
<h1><i class="fa fa-camera-retro"></i> Font awesome support</h1>
<div class="mermaid" id="i211">
graph LR
A["A double quote:#quot;"] -->B["A dec char:#9829;"]
B -->C["#9829; ;^; #60;"]
C--> D(fa:fa-camera-retro);
D--> E(tjo);
A["A double quote:#quot;"] -->B["fa:fa-twitter nu springer vi"]
B -->C[fa:fa-ban nu springer vi]
C--> D(fa:fa-spinner);
D--> E(En fa:fa-camera-retro kanske?);
</div>
<div class="mermaid" id="i211">
sequenceDiagram
Expand Down

0 comments on commit ed65e6d

Please sign in to comment.