forked from apache/pulsar-site
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docusaurus.config.js
487 lines (476 loc) · 14 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
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
// @ts-check
const _ = require("lodash");
const linkifyRegex = require("./plugins/remark-linkify-regex");
const { renderAnnouncementBar } = require("./src/components/ui/renderAnnouncementBar");
const versions = require("./versions.json");
const latestVersion = versions[0];
const versionsMap = {
..._.keyBy(
versions.map((item) => {
return {
label: item,
path: item,
};
}),
"label"
),
current: {
label: "Next",
path: "next",
},
};
let buildVersions = ["current"];
try {
buildVersions = require("./.build-versions.json");
} catch (error) {
//do nothing
}
const oldUrl = "https://pulsar.apache.org";
const url = "https://pulsar.apache.org";
const javadocUrl = url + "/api";
const restApiUrl = url + "/admin-rest-api";
const functionsApiUrl = url + "/functions-rest-api";
const sourceApiUrl = url + "/source-rest-api";
const sinkApiUrl = url + "/sink-rest-api";
const packagesApiUrl = url + "/packages-rest-api";
const transactionsApiUrl = url + "/transactions-rest-api";
const lookupApiUrl = url + "/lookup-rest-api";
const githubUrl = "https://github.com/apache/pulsar";
const githubSiteUrl = "https://github.com/apache/pulsar-site";
const baseUrl = "/";
const math = require('remark-math');
const katex = require('rehype-katex');
const injectLinkParse = ([, prefix, , name, path]) => {
if (prefix == "javadoc") {
return {
link: javadocUrl + path,
text: name,
};
} else if (prefix == "github") {
return {
link: githubUrl + "/tree/master/" + path,
text: name,
};
} else if (prefix == "rest") {
return {
link: restApiUrl + "#" + path,
text: name,
};
} else if (prefix == "functions") {
return {
link: functionsApiUrl + "#" + path,
text: name,
};
} else if (prefix == "source") {
return {
link: sourceApiUrl + "#" + path,
text: name,
};
} else if (prefix == "sink") {
return {
link: sinkApiUrl + "#" + path,
text: name,
};
} else if (prefix == "packages") {
return {
link: packagesApiUrl + "#" + path,
text: name,
};
}
return {
link: path,
text: name,
};
};
const injectLinkParseForEndpoint = ([, info]) => {
let [method, path, suffix] = info.split("|");
if (!suffix) {
suffix = "";
}
let restPath = path.split("/");
const restApiVersion = restPath[2];
const restApiType = restPath[3];
const restBaseUrl = {
functions: functionsApiUrl,
source: sourceApiUrl,
sink: sinkApiUrl,
packages: packagesApiUrl,
transactions: transactionsApiUrl,
lookup: lookupApiUrl
}[restApiType] || restApiUrl;
let restUrl;
if (suffix.indexOf("?version=") >= 0) {
const suffixAndVersion = suffix.split("?version=")
restUrl = "version=" + suffixAndVersion[1] + "&apiversion=" + restApiVersion + "#" + suffixAndVersion[0];
if (suffixAndVersion[0].startsWith("operation/")) {
path += suffixAndVersion[0].slice("operation".length)
}
} else {
restUrl = "version=master&apiversion=" + restApiVersion + "#" + suffix;
if (suffix.startsWith("operation/")) {
path += suffix.slice("operation".length)
}
}
return {
text: method + " " + path,
link: restBaseUrl + "?" + restUrl,
};
};
/** @type {import('@docusaurus/types').Config} */
module.exports = {
title: "Apache Pulsar",
tagline:
"Apache Pulsar is a distributed, open source pub-sub messaging and streaming platform for real-time workloads, managing hundreds of billions of events per day.",
url: "https://pulsar.apache.org",
baseUrl: baseUrl,
onBrokenLinks: "warn",
onBrokenMarkdownLinks: "warn",
favicon: "img/favicon.ico",
organizationName: "apache",
projectName: "pulsar",
customFields: {
githubUrl,
oldUrl,
},
trailingSlash: true,
themeConfig: {
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
announcementBar: {
id: "summit",
content: renderAnnouncementBar(
"Pulsar Summit North America 2023 CFP is open!",
"https://sessionize.com/pulsar-summit-north-america-2023/"
),
backgroundColor: "#282826",
textColor: "#fff",
isCloseable: false,
},
colorMode: {
disableSwitch: true,
},
navbar: {
title: "",
logo: {
alt: "Apache Pulsar logo",
src: "img/logo-black.svg",
width: 127,
height: 25
},
items: [
{
type: "dropdown",
label: "Get Started",
position: "left",
items: [
{
to: `/docs/${latestVersion}/concepts-overview/`,
activeBaseRegex: `docs/(${versions.join('|')})/concepts-overview/$`,
label: "Concepts",
},
{
to: `/docs/${latestVersion}/`,
activeBaseRegex: `docs/(${versions.join('|')})/$`,
label: "Quickstart",
},
{
to: "/ecosystem/",
label: "Ecosystem",
},
],
},
{
type: "doc",
docId: "about",
position: "left",
label: "Docs",
},
{
to: "/contribute/",
position: "left",
label: "Contribute",
},
{
type: "dropdown",
label: "Community",
position: "left",
className: "community-dropdown",
items: [
{
to: "/community",
activeBaseRegex: "^$",
label: "Welcome",
className: "scroll-link scroll-welcome",
id: "scroll-welcome",
},
{
to: "/community#section-discussions",
activeBaseRegex: "^$",
label: "Discussions",
className: "scroll-link scroll-discussions",
id: "scroll-discussions",
},
{
to: "/community#section-governance",
activeBaseRegex: "^$",
label: "Governance",
className: "scroll-link",
id: "scroll-governance",
},
{
to: "/community#section-community",
activeBaseRegex: "^$",
label: "Meet the Community",
className: "scroll-link",
id: "scroll-community",
},
{
to: "/community#section-contribute",
activeBaseRegex: "^$",
label: "Contribute",
className: "scroll-link",
id: "scroll-contribute",
},
{
to: "https://github.com/apache/pulsar/wiki",
label: "Wiki",
},
{
to: "https://github.com/apache/pulsar/issues",
label: "Issue Tracking",
},
],
},
{
type: "dropdown",
label: "Learn",
position: "left",
items: [
{
to: "/blog",
label: "Blog",
},
{
to: "/books",
label: "Books",
},
{
to: "/case-studies",
label: "Case Studies",
},
{
to: "/resources",
label: "Resources",
},
{
to: "/events",
label: "Events",
},
],
},
{
to: "/download",
label: "Download",
position: "right",
className: "navbar_download_button",
},
],
},
footer: {
logo: { alt: "Pulsar Logo", src: "img/pulsar-white.svg", href: "/" },
links: [
{
items: [
{ label: "Foundation", href: "https://www.apache.org/" },
{
label: "Events",
href: "https://www.apache.org/events/current-event.html",
},
],
},
{
items: [
{ label: "License", href: "https://www.apache.org/licenses/" },
{
label: "Thanks",
href: "https://www.apache.org/foundation/thanks",
},
{
label: "Sponsorship",
href: "https://www.apache.org/foundation/sponsorship",
},
],
},
{
items: [
{ label: "Security", href: "https://www.apache.org/security" },
{
label: "Privacy",
href: "https://www.apache.org/foundation/policies/privacy.html",
},
],
},
{
items: [
{
html: `
<div class="social-icons">
<a
target="_blank"
href="https://communityinviter.com/apps/apache-pulsar/apache-pulsar"
aria-label="Join the Apache Pulsar Slack workspace"
>
<img alt="Slack logo" src="/img/slack-white.svg" width="26">
</a>
<a
target="_blank"
href="https://github.com/apache/pulsar/"
aria-label="View the Apache Pulsar project on GitHub"
>
<img alt="GitHub logo" src="/img/github-white.svg" width="26">
</a>
</div>
`,
},
],
},
],
copyright: `
<div>
<img class="footer-apache-logo" src="/img/feather-logo-white.svg" alt="" width="20">
Apache Foundation
</div>
<p>Apache Pulsar is available under the Apache License, version 2.0. Apache Pulsar is an open-source, distributed messaging and streaming platform built for the cloud.</p>
<p>Copyright © ${new Date().getFullYear()} The Apache Software Foundation. All Rights Reserved. Apache, Pulsar, Apache Pulsar, and the Apache feather logo are trademarks or registered trademarks of The Apache Software Foundation.</p>
`,
},
prism: {
theme: require("prism-react-renderer/themes/dracula"),
additionalLanguages: [
"csharp",
"groovy",
"http",
"ini",
"java",
"powershell",
"properties",
"protobuf",
"yaml",
],
},
algolia: {
appId: "WK2YL0SALL",
apiKey: "42d24d221fbd8eb59804a078208aaec0",
indexName: "apache_pulsar",
},
},
presets: [
[
"@docusaurus/preset-classic",
/** @type {import('@docusaurus/preset-classic').Options} */
{
docs: {
path: "docs",
sidebarPath: require.resolve("./sidebars.js"),
editUrl: `${githubSiteUrl}/edit/main`,
remarkPlugins: [
linkifyRegex(
/{\@inject\:\s?(((?!endpoint)[^}])+):([^}]+):([^}]+)}/,
injectLinkParse
),
linkifyRegex(
/{\@inject\:\s?endpoint\|([^}]+)}/,
injectLinkParseForEndpoint
),
math,
],
rehypePlugins: [katex],
versions: versionsMap,
onlyIncludeVersions: buildVersions || ["current"],
},
blog: {
blogSidebarTitle: 'All posts',
blogSidebarCount: 'ALL',
showReadingTime: true,
editUrl: `${githubSiteUrl}/edit/main/`,
},
theme: {
customCss: [
require.resolve("./src/css/custom.css"),
require.resolve("./src/css/docs.css"),
require.resolve("./src/css/base-table.css"),
require.resolve("./src/css/typography.css"),
require.resolve("./src/css/announcement-bar.css"),
require.resolve("./src/css/navbar.css"),
require.resolve("./src/css/footer.css"),
require.resolve("./src/css/variables.css"),
],
},
//googleAnalytics: {
// trackingID: "UA-102219959-1",
//},
},
],
],
plugins: [
[
"content-docs",
/** @type {import('@docusaurus/plugin-content-docs').Options} */
({
id: "contribute",
path: "contribute",
routeBasePath: "contribute",
showLastUpdateAuthor: true,
showLastUpdateTime: true,
sidebarPath: require.resolve("./sidebarsDevelopment.js"),
editUrl: `${githubSiteUrl}/edit/main`,
}),
],
[
"content-docs",
/** @type {import('@docusaurus/plugin-content-docs').Options} */
({
id: "release-notes",
path: "release-notes",
routeBasePath: "release-notes",
editUrl: `${githubSiteUrl}/edit/main`,
sidebarPath: require.resolve("./sidebarsReleaseNotes.js"),
}),
],
[
"content-docs",
/** @type {import('@docusaurus/plugin-content-docs').Options} */
({
id: "security",
path: "security",
routeBasePath: "security",
sidebarPath: false,
}),
],
[
"content-docs",
/** @type {import('@docusaurus/plugin-content-docs').Options} */
({
id: "client-feature-matrix",
path: "client-feature-matrix",
routeBasePath: "client-feature-matrix",
sidebarPath: false,
}),
],
],
scripts: [
{ src: "/js/sine-waves.min.js", async: true },
"/js/matomo-agent.js",
],
clientModules: [require.resolve("./matomoClientModule.ts")],
stylesheets: [
{
href: "https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css",
type: "text/css",
integrity:
"sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM",
crossorigin: "anonymous",
media: "print", // load CSS asynchronously to increase performance of page first load
onload: "this.media='all'", // load CSS asynchronously to increase performance of page first load
},
],
};