Skip to content

Commit b7637d1

Browse files
committed
feat: flowchart
1 parent d7186b7 commit b7637d1

File tree

4 files changed

+19
-13
lines changed

4 files changed

+19
-13
lines changed

docs/.vitepress/config.mts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {tabsPlugin} from "./theme/tabs/markdownPlugin";
88
import fs from "fs";
99
import {exampleAutoAnchorPreprocessor} from "./theme/anchor/exampleAutoAnchorPreprocessor";
1010
import {mathjaxContainerPreprocessor} from "./theme/mathjax/mathjaxContainerPreprocessor";
11+
import {withMermaid} from "vitepress-plugin-mermaid";
1112

1213
const defaultLocale: string = 'en';
1314
const supportLocales: string[] = [
@@ -153,4 +154,4 @@ function getBase(): string {
153154
}
154155
}
155156

156-
export default defineConfig(withSidebar(withI18n(vitepressOptions, vitePressI18nOptions), vitepressSidebarOptions))
157+
export default withMermaid(withSidebar(withI18n(vitepressOptions, vitePressI18nOptions), vitepressSidebarOptions))

docs/.vitepress/theme/style/global.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,8 @@
2222

2323
.DocSearch-Button .DocSearch-Button-Key + .DocSearch-Button-Key {
2424
border: none;
25+
}
26+
27+
.mermaid {
28+
display:flex; justify-content:center;align-items:center
2529
}

docs/en/create-commands/arguments/types/command-arguments.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -104,18 +104,17 @@ To demonstrate restricting commands, let's create a command argument that allows
104104

105105
Let's also add a restriction that the player can only use diamonds or dirt for the `/give` command, and they can only specify an amount if they selected dirt. Overall, our command argument should allow players to follow this path:
106106

107-
$$\begin{gather}
108-
\texttt{(start)}\\\\
109-
\swarrow\hspace{1.2cm}\searrow\\\\
110-
\texttt{tp}\hspace{2cm}\texttt{give}\\\\
111-
\swarrow\hspace{3cm}\searrow\\\\
112-
\texttt{player}\hspace{3.25cm}\texttt{player}\\\\
113-
\hspace{0.25cm}\swarrow\hspace{3.75cm}\swarrow\hspace{1cm}\searrow\\\\
114-
\hspace{0.25cm}\texttt{target}\hspace{3cm}\texttt{diamond}\hspace{1.75cm}\texttt{dirt}\\\\
115-
\hspace{4.9cm}\texttt{minecraft:diamond}\hspace{1.75cm}\texttt{minecraft:dirt}\\\\
116-
\hspace{10cm}\downarrow\\\\
117-
\hspace{10cm}\texttt{(amount)}\\\\
118-
\end{gather}$$
107+
```mermaid
108+
graph TD
109+
A((Start)) --> B(tp)
110+
B --> C(player)
111+
C --> D(target)
112+
A --> E(give)
113+
E --> F(player)
114+
F --> G(diamond<br/>or<br/>minecraft:diamond)
115+
F --> I(dirt<br/>or<br/>minecraft:dirt)
116+
I --> J(amount)
117+
```
119118

120119
In our diagram above, we have two main branches: `/tp` and `/give`. The `/tp` branch has `player` followed by `target`, and the `/give` branch has `player` and then that branches off into two new sections.
121120

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
"markdown-it-container": "^4.0.0",
2020
"markdown-it-mathjax3": "^4.3.2",
2121
"medium-zoom": "^1.1.0",
22+
"mermaid": "^11.4.1",
2223
"vitepress": "^1.5.0",
24+
"vitepress-plugin-mermaid": "^2.0.17",
2325
"vitepress-sidebar": "^1.29.0"
2426
},
2527
"scripts": {

0 commit comments

Comments
 (0)