Writerside Help

D2 diagrams

Writerside supports adding diagrams using D2, a declarative language for diagramming.

To add a D2 diagram, use a code block with the language set to d2:

<code-block lang="d2"> direction: right question: Do you write docs? yes: Use Writerside no: You should question -> yes: Yes question -> no: No </code-block>
```d2 direction: right question: Do you write docs? yes: Use Writerside no: You should question -> yes: Yes question -> no: No ```

The result will look as follows:

Do you write docs?Use WritersideYou should YesNo

Reference D2 diagram from file

If you have a file with D2 code, you can reference it instead of copying the D2 code into the code block. For more information, see Reference code from file.

<code-block lang="D2" src="graph.d2"/>
```D2 ``` { src="graph.d2" }

Or via a relative path:

<code-block lang="D2" src="../codeSnippets/graph.d2"/>
```D2 ``` { src="../codeSnippets/graph.d2" }
Last modified: 11 November 2024