forked from mermaid-js/mermaid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.ts
237 lines (227 loc) · 7.48 KB
/
config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
import { defineConfig, MarkdownOptions } from 'vitepress';
import { version } from '../../../package.json';
import MermaidExample from './mermaid-markdown-all.js';
const allMarkdownTransformers: MarkdownOptions = {
// the shiki theme to highlight code blocks
theme: {
light: 'github-light',
dark: 'github-dark',
},
config: async (md) => {
await MermaidExample(md);
},
};
export default defineConfig({
lang: 'en-US',
title: 'Mermaid',
description: 'Create diagrams and visualizations using text and code.',
base: '/',
markdown: allMarkdownTransformers,
ignoreDeadLinks: [
// ignore all localhost links
/^https?:\/\/localhost/,
],
head: [
['link', { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }],
[
'script',
{
defer: 'true',
'data-domain': 'mermaid.js.org',
// All tracked stats are public and available at https://p.mermaid.live/mermaid.js.org
src: 'https://p.mermaid.live/js/script.tagged-events.outbound-links.js',
},
],
],
themeConfig: {
nav: nav(),
editLink: {
pattern: ({ filePath, frontmatter }) => {
if (typeof frontmatter.editLink === 'string') {
return frontmatter.editLink;
}
return `https://github.com/mermaid-js/mermaid/edit/develop/packages/mermaid/src/docs/${filePath}`;
},
text: 'Edit this page on GitHub',
},
sidebar: {
'/': sidebarAll(),
},
outline: {
level: 'deep',
},
socialLinks: [
{ icon: 'github', link: 'https://github.com/mermaid-js/mermaid' },
{
icon: 'discord',
link: 'https://discord.gg/AgrbSrBer3',
},
{
icon: {
svg: '<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 490.16 490.16"><defs><mask id="Mask"><rect x="0" y="0" width="490.16" height="490.16" fill="white" /><path fill="black" d="M407.48,111.18A165.2,165.2,0,0,0,245.08,220,165.2,165.2,0,0,0,82.68,111.18a165.5,165.5,0,0,0,72.06,143.64,88.81,88.81,0,0,1,38.53,73.45v50.86H296.9V328.27a88.8,88.8,0,0,1,38.52-73.45,165.41,165.41,0,0,0,72.06-143.64Z"/><path fill="black" d="M160.63,328.27a56.09,56.09,0,0,0-24.27-46.49,198.74,198.74,0,0,1-28.54-23.66A196.87,196.87,0,0,1,82.53,227V379.13h78.1Z"/><path fill="black" d="M329.53,328.27a56.09,56.09,0,0,1,24.27-46.49,198.74,198.74,0,0,0,28.54-23.66A196.87,196.87,0,0,0,407.63,227V379.13h-78.1Z"/></mask><style>.cls-1{fill:#76767B;}.cls-1:hover{fill:#FF3570}</style></defs><rect class="cls-1" width="490.16" height="490.16" rx="84.61" mask="url(#Mask)" /></svg>',
},
link: 'https://www.mermaidchart.com/',
},
],
},
});
// Top (across the page) menu
function nav() {
return [
{ text: 'Docs', link: '/intro/', activeMatch: '/intro/' },
{
text: 'Tutorials',
link: '/ecosystem/tutorials',
activeMatch: '/ecosystem/tutorials',
},
{
text: 'Integrations',
link: '/ecosystem/integrations-community',
activeMatch: '/ecosystem/integrations-community',
},
{
text: 'Contributing',
link: '/community/intro',
activeMatch: '/community/',
},
{
text: 'Latest News',
link: '/news/announcements',
activeMatch: '/announcements',
},
{
text: version,
items: [
{
text: 'Changelog',
link: 'https://github.com/mermaid-js/mermaid/releases',
},
],
},
{
text: '💻 Live Editor',
link: 'https://mermaid.live',
},
];
}
function sidebarAll() {
return [
{
text: '📔 Introduction',
collapsed: false,
items: [
{ text: 'About Mermaid', link: '/intro/' },
{ text: 'Getting Started', link: '/intro/getting-started' },
{ text: 'Syntax and Configuration', link: '/intro/syntax-reference' },
],
},
...sidebarSyntax(),
...sidebarEcosystem(),
...sidebarConfig(),
...sidebarCommunity(),
...sidebarNews(),
];
}
function sidebarSyntax() {
return [
{
text: '📊 Diagram Syntax',
collapsed: false,
items: [
{ text: 'Flowchart', link: '/syntax/flowchart' },
{ text: 'Sequence Diagram', link: '/syntax/sequenceDiagram' },
{ text: 'Class Diagram', link: '/syntax/classDiagram' },
{ text: 'State Diagram', link: '/syntax/stateDiagram' },
{
text: 'Entity Relationship Diagram',
link: '/syntax/entityRelationshipDiagram',
},
{ text: 'User Journey', link: '/syntax/userJourney' },
{ text: 'Gantt', link: '/syntax/gantt' },
{ text: 'Pie Chart', link: '/syntax/pie' },
{ text: 'Quadrant Chart', link: '/syntax/quadrantChart' },
{ text: 'Requirement Diagram', link: '/syntax/requirementDiagram' },
{ text: 'Gitgraph (Git) Diagram', link: '/syntax/gitgraph' },
{ text: 'C4 Diagram 🦺⚠️', link: '/syntax/c4' },
{ text: 'Mindmaps', link: '/syntax/mindmap' },
{ text: 'Timeline', link: '/syntax/timeline' },
{ text: 'Zenuml', link: '/syntax/zenuml' },
{ text: 'Sankey 🔥', link: '/syntax/sankey' },
{ text: 'XYChart 🔥', link: '/syntax/xyChart' },
{ text: 'Block Diagram 🔥', link: '/syntax/block' },
{ text: 'Packet 🔥', link: '/syntax/packet' },
{ text: 'Other Examples', link: '/syntax/examples' },
],
},
];
}
function sidebarConfig() {
return [
{
text: '⚙️ Deployment and Configuration',
collapsed: false,
items: [
{ text: 'Configuration', link: '/config/configuration' },
{ text: 'API-Usage', link: '/config/usage' },
{ text: 'Mermaid API Configuration', link: '/config/setup/README' },
{ text: 'Mermaid Configuration Options', link: '/config/schema-docs/config' },
{ text: 'Directives', link: '/config/directives' },
{ text: 'Theming', link: '/config/theming' },
{ text: 'Math', link: '/config/math' },
{ text: 'Accessibility', link: '/config/accessibility' },
{ text: 'Mermaid CLI', link: '/config/mermaidCLI' },
{ text: 'FAQ', link: '/config/faq' },
],
},
];
}
function sidebarEcosystem() {
return [
{
text: '📚 Ecosystem',
collapsed: false,
items: [
{ text: 'Mermaid Chart', link: '/ecosystem/mermaid-chart' },
{ text: 'Tutorials', link: '/ecosystem/tutorials' },
{ text: 'Integrations - Community', link: '/ecosystem/integrations-community' },
{ text: 'Integrations - Create', link: '/ecosystem/integrations-create' },
],
},
];
}
function sidebarCommunity() {
return [
{
text: '🙌 Contributing',
collapsed: false,
items: [
{ text: 'Getting Started', link: '/community/intro' },
{ text: 'Contributing to Mermaid', link: '/community/contributing' },
{ text: 'Adding Diagrams', link: '/community/new-diagram' },
{ text: 'Questions and Suggestions', link: '/community/questions-and-suggestions' },
{ text: 'Security', link: '/community/security' },
],
},
];
}
function sidebarNews() {
return [
{
text: '📰 Latest News',
collapsed: false,
items: [
{ text: 'Announcements', link: '/news/announcements' },
{ text: 'Blog', link: '/news/blog' },
],
},
];
}
/**
* Return a string that puts together the pagePage, a '#', then the given id
* @param pagePath
* @param id
* @returns the fully formed path
*/
function pathToId(pagePath: string, id = ''): string {
return pagePath + '#' + id;
}