diff --git a/src/dagre-wrapper/GraphObjects.md b/src/dagre-wrapper/GraphObjects.md index 30365e1c8..a4e6b854c 100644 --- a/src/dagre-wrapper/GraphObjects.md +++ b/src/dagre-wrapper/GraphObjects.md @@ -113,8 +113,8 @@ Required edgeData for proper rendering: | label | overlap between label and labelText? | | labelPos | | | labelType | overlap between label and labelText? | -| thickness | Sets the thinkess of the edge. Can be ['normal', 'thick'] | -| pattern | Sets the pattern of the edge. Can be ['solid', 'dotted', 'dashed'] | +| thickness | Sets the thinkess of the edge. Can be \['normal', 'thick'\] | +| pattern | Sets the pattern of the edge. Can be \['solid', 'dotted', 'dashed'\] | # Markers @@ -122,7 +122,7 @@ Required edgeData for proper rendering: Define what markers that should be included in the diagram with the insert markers function. The function takes two arguments, first the element in which the markers should be included and a list of the markers that should be added. Ex: -insertMarkers(el, ['point', 'circle']) +insertMarkers(el, \['point', 'circle'\]) The example above adds the markers point and cross. This means that edges with the arrowTypes arrow_cross, double_arrow_cross, arrow_point and double_arrow_cross will get the corresponding markers but arrowType arrow_cross will have no impact. @@ -136,4 +136,4 @@ Current markers: # Common functions used by the renderer to be implemented by the Db getDirection -getClasses \ No newline at end of file +getClasses diff --git a/src/diagrams/flowchart/parser/flow.jison b/src/diagrams/flowchart/parser/flow.jison index 98aa7eb60..ed5bc2682 100644 --- a/src/diagrams/flowchart/parser/flow.jison +++ b/src/diagrams/flowchart/parser/flow.jison @@ -6,10 +6,15 @@ /* lexical grammar */ %lex +%options case-insensitive + %x string %x dir %x vertex -%x open_directive type_directive arg_directive +%x open_directive +%x type_directive +%x arg_directive +%x close_directive %% \%\%\{ { this.begin('open_directive'); return 'open_directive'; } @@ -33,6 +38,7 @@ "flowchart" {if(yy.lex.firstGraph()){this.begin("dir");} return 'GRAPH';} "subgraph" return 'subgraph'; "end"\b\s* return 'end'; +[^\n\s]* { this.popState(); } \s*"LR" { this.popState(); return 'DIR'; } \s*"RL" { this.popState(); return 'DIR'; } \s*"TB" { this.popState(); return 'DIR'; } @@ -187,7 +193,7 @@ "{" return 'DIAMOND_START' "}" return 'DIAMOND_STOP' "\"" return 'QUOTE'; -(\r|\n|\r\n)+ return 'NEWLINE'; +(\r?\n)+ return 'NEWLINE'; \s return 'SPACE'; <> return 'EOF'; @@ -233,8 +239,10 @@ directive graphConfig : SPACE graphConfig | NEWLINE graphConfig + | GRAPH FirstStmtSeperator + { console.log('GRAPH FirstStmtSeperator');yy.setDirection('TB');$$ = 'TB';} | GRAPH DIR FirstStmtSeperator - { yy.setDirection($2);$$ = $2;} + { console.log('GRAPH DIR FirstStmtSeperator');yy.setDirection($2);$$ = $2;} // | GRAPH SPACE TAGEND FirstStmtSeperator // { yy.setDirection("LR");$$ = $3;} // | GRAPH SPACE TAGSTART FirstStmtSeperator diff --git a/src/diagrams/state/stateRenderer-v2.js b/src/diagrams/state/stateRenderer-v2.js index 073654bc8..9b0fe2fa4 100644 --- a/src/diagrams/state/stateRenderer-v2.js +++ b/src/diagrams/state/stateRenderer-v2.js @@ -211,11 +211,11 @@ export const draw = function(text, id) { parser.yy = stateDb; // Parse the graph definition - try { - parser.parse(text); - } catch (err) { - logger.debug('Parsing failed'); - } + // try { + parser.parse(text); + // } catch (err) { + // logger.error('Parsing failed', err); + // } // Fetch the default direction, use TD if none was found let dir = stateDb.getDirection(); diff --git a/src/mermaidAPI.js b/src/mermaidAPI.js index c44baff77..9ab2ce9c7 100644 --- a/src/mermaidAPI.js +++ b/src/mermaidAPI.js @@ -205,7 +205,6 @@ const render = function(id, _txt, cb, container) { } else { configApi.reset(); const siteConfig = getSiteConfig(); - updateRendererConfigs(siteConfig); reinitialize(siteConfig); }