You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/docs/shared/mermaidwrapper.mdx
+40-1Lines changed: 40 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,11 @@ This component allows users to open a Mermaid diagram in a new tab, as well as d
10
10
We assume that you have already imported the [Mermaid component](/shared/mermaid), otherwise, what on earth are you wrapping with this?
11
11
:::
12
12
13
-
The component adds a link to "View full image" with an external link indicator under the bottom-right corner of the image, as well as a link to "Download diagram", which will download the diagram as an SVG file when clicked. Do use the `diagramName` prop to specify the name of the diagram file that will be saved to the user's local machine (otherwise it will default to `diagram.svg`).
13
+
The component adds a link to "View full image" with an external link indicator under the bottom-right corner of the image, as well as a link to "Download diagram", which will download the diagram as an SVG file when clicked. It takes in a `viewLabel`, `downloadLabel` and `diagramName` properties.
14
+
15
+
The `viewLabel` and `downloadLabel` props allow you to customize the text of the buttons, the use case being for pages that are not in English. If you don't provide these props, they will default to "View full diagram" and "Download diagram", respectively.
16
+
17
+
Do use the `diagramName` prop to specify the name of the diagram file that will be saved to the user's local machine (otherwise it will default to `diagram.svg`).
14
18
15
19
To use the component, the page must be in `.mdx` format. Change the format from `.md` to `.mdx` if necessary. All your existing markdown will still be supported without issue.
16
20
@@ -63,6 +67,24 @@ By default, there will be a border around the diagram. To remove the border, pas
63
67
</MermaidWrapper>
64
68
```
65
69
70
+
To translate the labels for the diagram's available actions, pass in the `viewLabel` and `downloadLabel` attributes.
If you're using some sort of format-on-save functionality in your code editor, like Prettier, it might mess up your formatting. Ask Prettier, for example, to ignore your Mermaid block just in case. Refer to the example code above.
67
89
68
90
```
@@ -109,3 +131,20 @@ When `hasBorder: false` is used:
0 commit comments