forked from vegaprotocol/documentation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocusaurus.config.js
267 lines (263 loc) · 7.79 KB
/
docusaurus.config.js
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
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
/** @type {import('@docusaurus/types').DocusaurusConfig} */
const { shortenVersion, openApiConfig, version, mainnetVersion } = require('./scripts/docusaurus.config.openapi.js')
module.exports = {
title: "Vega Protocol",
tagline: "A protocol for creating and trading derivatives on a fully decentralised network",
url: "https://docs.vega.xyz/",
baseUrl: "/",
trailingSlash: false,
onBrokenLinks: "throw",
onBrokenMarkdownLinks: "warn",
favicon: "img/favicon.ico",
organizationName: "vegaprotocol",
projectName: "documentation",
themeConfig: {
image: "img/logo-y.png",
navbar: {
title: "Vega documentation",
logo: {
alt: "Vega Protocol Logo",
src: "img/logo-y.png",
},
items: [
/* {
type: "docsVersionDropdown",
position: "right",
// Removes the All Versions page
dropdownItemsAfter: [],
dropdownActiveClassDisabled: true,
// Makes the menu not clickable when not open
href: '#'
}, */
{
href: "https://github.com/vegaprotocol/documentation",
label: "GitHub",
position: "right",
},
{
type: "doc",
docId: "concepts/new-to-vega",
label: "Concepts",
position: "left",
},
{
type: "doc",
docId: "api/overview",
label: "APIs",
position: "left",
},
{
type: "doc",
docId: "tools/index",
label: "Apps and Tools",
position: "left",
},
{
type: "doc",
docId: "releases/overview",
label: "Releases",
position: "left",
},
{
type: "doc",
docId: "node-operators/index",
label: "Node operators",
position: "left",
},
],
},
footer: {
style: "dark",
links: [
{
title: "Vega Protocol",
items: [
{
label: "Website",
to: "http://vega.xyz/",
},
{
label: "GitHub",
to: "https://github.com/vegaprotocol",
},
{
label: "Blog",
to: "https://blog.vega.xyz",
},
{
label: "Twitch",
to: "https://www.twitch.tv/vegaprotocol",
},
{
label: "YouTube",
to: "https://www.youtube.com/vegaprotocol",
},
],
},
{
title: "Community",
items: [
{
label: "Discord",
to: "https://vega.xyz/discord",
},
{
label: "Twitter",
to: "https://twitter.com/vegaprotocol",
},
{
label: "Forum",
to: "https://community.vega.xyz/",
},
{
label: "Telegram",
to: "https://t.me/vegacommunity",
},
],
},
{
title: "Fairground",
items: [
{
label: "Home",
to: "https://fairground.wtf/",
},
{
label: "Docs",
to: "https://docs.fairground.vega.xyz/",
},
{
label: "Vega Console",
to: "https://console.fairground.wtf/",
},
],
},
],
copyright: `Copyright ©2018-${new Date().getFullYear()} Gobalsky Labs Limited, registered in Gibraltar`,
},
languageTabs: [
{
highlight: "bash",
language: "curl",
logoClass: "bash",
},
{
highlight: "python",
language: "python",
logoClass: "python",
},
{
highlight: "go",
language: "go",
logoClass: "go",
},
{
highlight: "javascript",
language: "nodejs",
logoClass: "nodejs",
}
],
},
plugins: [
[
// This plugin extends the CLI to give us a generator that takes in our schema and produces
// markdown files inside the docs folder, so these are included in the versioned docs.
require.resolve("@edno/docusaurus2-graphql-doc-generator"),
{
schema: `./specs/v${version}/schema.graphql`,
rootPath: "docs",
baseURL: "graphql",
linkRoot: "/docs/testnet/",
diffMethod: "none",
docOptions: {
toc: true,
pagination: true,
index: true
}
}
],
[
// An alternative to algolia
require.resolve("@easyops-cn/docusaurus-search-local"),
{
language: ["en"],
hashed: true,
explicitSearchResultPath: true,
indexBlog: false,
docsRouteBasePath: ["/docs"],
},
],
[
// docusaurus-protobuffet as a preset is the standard approach. However, we want the GRPC docs to be
// versioned along with the ./docs/ folder, so here we are using the plugin for it's file generation
// portion only. The *plugin* extends the docusaurus CLI to give us `generate-grpc`, but does not
// set up another instance of `docs` that controls rendering for the GRPC portion of the docs. Which
// is to say: GRPC is treated like any other part of our docs.
//
// The weird thing this causes is that the React components in ProtoFile are provided by the theme, which
// is no long available - so that component has been 'swizzled' out of the theme and in to ./src/theme
require.resolve("docusaurus-protobuffet-plugin"),
{
routeBasePath: "/docs/testnet/grpc",
fileDescriptorsPath: `./specs/v${version}/proto.json`,
protoDocsPath: "./docs/grpc",
sidebarPath: "./docs/grpc/sidebar.js",
},
],
[
// See ./scripts/docusaurus.config.openapi.js for how this is generated, but in short it takes the
// current 'mainnet' vresion and the current 'testnet' version from package.json, iterates over the
// ./specs/[version number] folder to get all the swagger files, then generates them in a predictable
// way
"docusaurus-plugin-openapi-docs",
{
id: "apiDocs",
docsPluginId: "classic",
config: openApiConfig
},
],
],
presets: [
[
"@docusaurus/preset-classic",
{
debug: undefined,
// We don't have a '/blog/' section on the site, so disable this section
blog: false,
// Configuration for the '/docs/' section of the site
docs: {
disableVersioning: false,
sidebarPath: require.resolve("./sidebars.js"),
editUrl: "https://github.com/vegaprotocol/documentation/edit/main/",
lastVersion: `v${shortenVersion(mainnetVersion)}`,
docLayoutComponent: "@theme/DocPage",
docItemComponent: "@theme/ApiItem",
versions: {
current: {
banner: "unreleased",
label: `testnet (v${shortenVersion(version)})`,
path: "testnet",
// Hacky: Classname used for full version number, v prefix. Used for OpenrpcPlayground
className: `v${version}`
},
"v0.53": {
banner: "none",
label: `mainnet (v${shortenVersion(mainnetVersion)})`,
path: "mainnet",
// Hacky: Classname used for full version number, v prefix. Used for OpenrpcPlayground
className: `v${mainnetVersion}`
}
},
},
// Vega specific theme overrides go here
theme: {
customCss: require.resolve("./src/css/custom.css"),
},
},
],
],
themes: [
"docusaurus-theme-openapi-docs",
"@vegaprotocol/docusaurus-theme-github-codeblock",
],
};