Skip to content

Commit

Permalink
Merge pull request #4688 from Incognito/docs/4659_new-diagrams-no-dir…
Browse files Browse the repository at this point in the history
…ectives

Docs: Directives not needed in new diagrams as yaml formatter does this for all new diagrams
  • Loading branch information
sidharthv96 authored Aug 1, 2023
2 parents cc7fd33 + cc01ff9 commit 6e2bf00
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 96 deletions.
49 changes: 1 addition & 48 deletions docs/community/newDiagram.md
Original file line number Diff line number Diff line change
Expand Up @@ -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'; }
<open_directive>((?:(?!\}\%\%)[^:.])*) { this.begin('type_directive'); return 'type_directive'; }
<type_directive>":" { this.popState(); this.begin('arg_directive'); return ':'; }
<type_directive,arg_directive>\}\%\% { this.popState(); this.popState(); return 'close_directive'; }
<arg_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:
Expand All @@ -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
Expand Down
49 changes: 1 addition & 48 deletions packages/mermaid/src/docs/community/newDiagram.md
Original file line number Diff line number Diff line change
Expand Up @@ -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'; }
<open_directive>((?:(?!\}\%\%)[^:.])*) { this.begin('type_directive'); return 'type_directive'; }
<type_directive>":" { this.popState(); this.begin('arg_directive'); return ':'; }
<type_directive,arg_directive>\}\%\% { this.popState(); this.popState(); return 'close_directive'; }
<arg_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:
Expand All @@ -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
Expand Down

0 comments on commit 6e2bf00

Please sign in to comment.