diff --git a/docs/community/newDiagram.md b/docs/community/newDiagram.md index bb7e2a9615..ba52999f4d 100644 --- a/docs/community/newDiagram.md +++ b/docs/community/newDiagram.md @@ -124,53 +124,6 @@ There are a few features that are common between the different types of diagrams Here some pointers on how to handle these different areas. -#### [Directives](../config/directives.md) - -Here is example handling from flowcharts: -Jison: - -```jison -/* lexical grammar */ -%lex -%x open_directive -%x type_directive -%x arg_directive -%x close_directive - -\%\%\{ { this.begin('open_directive'); return 'open_directive'; } -((?:(?!\}\%\%)[^:.])*) { this.begin('type_directive'); return 'type_directive'; } -":" { this.popState(); this.begin('arg_directive'); return ':'; } -\}\%\% { this.popState(); this.popState(); return 'close_directive'; } -((?:(?!\}\%\%).|\n)*) return 'arg_directive'; - -/* language grammar */ - -/* ... */ - -directive - : openDirective typeDirective closeDirective separator - | openDirective typeDirective ':' argDirective closeDirective separator - ; - -openDirective - : open_directive { yy.parseDirective('%%{', 'open_directive'); } - ; - -typeDirective - : type_directive { yy.parseDirective($1, 'type_directive'); } - ; - -argDirective - : arg_directive { $1 = $1.trim().replace(/'/g, '"'); yy.parseDirective($1, 'arg_directive'); } - ; - -closeDirective - : close_directive { yy.parseDirective('}%%', 'close_directive', 'flowchart'); } - ; -``` - -It is probably a good idea to keep the handling similar to this in your new diagram. The parseDirective function is provided by the mermaidAPI. - ## Accessibility Mermaid automatically adds the following accessibility information for the diagram SVG HTML element: @@ -189,7 +142,7 @@ See [the definition of aria-roledescription](https://www.w3.org/TR/wai-aria-1.1/ The syntax for accessible titles and descriptions is described in [the Accessibility documenation section.](../config/accessibility.md) -In a similar way to the directives, the jison syntax are quite similar between the diagrams. +As a design goal, the jison syntax should be similar between the diagrams. ```jison diff --git a/packages/mermaid/src/docs/community/newDiagram.md b/packages/mermaid/src/docs/community/newDiagram.md index 75e17e4c9b..3393396ee9 100644 --- a/packages/mermaid/src/docs/community/newDiagram.md +++ b/packages/mermaid/src/docs/community/newDiagram.md @@ -119,53 +119,6 @@ There are a few features that are common between the different types of diagrams Here some pointers on how to handle these different areas. -#### [Directives](../config/directives.md) - -Here is example handling from flowcharts: -Jison: - -```jison -/* lexical grammar */ -%lex -%x open_directive -%x type_directive -%x arg_directive -%x close_directive - -\%\%\{ { this.begin('open_directive'); return 'open_directive'; } -((?:(?!\}\%\%)[^:.])*) { this.begin('type_directive'); return 'type_directive'; } -":" { this.popState(); this.begin('arg_directive'); return ':'; } -\}\%\% { this.popState(); this.popState(); return 'close_directive'; } -((?:(?!\}\%\%).|\n)*) return 'arg_directive'; - -/* language grammar */ - -/* ... */ - -directive - : openDirective typeDirective closeDirective separator - | openDirective typeDirective ':' argDirective closeDirective separator - ; - -openDirective - : open_directive { yy.parseDirective('%%{', 'open_directive'); } - ; - -typeDirective - : type_directive { yy.parseDirective($1, 'type_directive'); } - ; - -argDirective - : arg_directive { $1 = $1.trim().replace(/'/g, '"'); yy.parseDirective($1, 'arg_directive'); } - ; - -closeDirective - : close_directive { yy.parseDirective('}%%', 'close_directive', 'flowchart'); } - ; -``` - -It is probably a good idea to keep the handling similar to this in your new diagram. The parseDirective function is provided by the mermaidAPI. - ## Accessibility Mermaid automatically adds the following accessibility information for the diagram SVG HTML element: @@ -184,7 +137,7 @@ See [the definition of aria-roledescription](https://www.w3.org/TR/wai-aria-1.1/ The syntax for accessible titles and descriptions is described in [the Accessibility documenation section.](../config/accessibility.md) -In a similar way to the directives, the jison syntax are quite similar between the diagrams. +As a design goal, the jison syntax should be similar between the diagrams. ```jison