UNPKG

mermaid

Version:

Markdownish syntax for generating flowcharts

50 lines 1.52 kB
[ { "tags": [], "description": { "full": "Created by knut on 14-11-23.", "summary": "Created by knut on 14-11-23.", "body": "" }, "isPrivate": false, "ignore": false }, { "tags": [ { "type": "param", "types": [ "string" ], "name": "text", "description": "The text defining the graph" }, { "type": "param", "types": [ "string" ], "name": "text", "description": "The second text defining the graph" }, { "type": "returns", "string": "{string} A graph definition key" } ], "description": { "full": "Detects the type of the graph text.", "summary": "Detects the type of the graph text.", "body": "" }, "isPrivate": false, "ignore": false, "code": "module.exports.detectType = function(text,a){\n if(text.match(/^\\s*sequenceDiagram/)){\n console.log('Detected sequenceDiagram syntax');\n return \"sequenceDiagram\";\n }\n\n if(text.match(/^\\s*sequence/)){\n //console.log('Detected sequence syntax');\n return \"sequence\";\n }\n\n if(text.match(/^\\s*digraph/)) {\n console.log('Detected flow syntax');\n return \"dotGraph\";\n }\n\n return \"graph\";\n}", "ctx": { "type": "method", "receiver": "module.exports", "name": "detectType", "string": "module.exports.detectType()" } } ]