forked from apache/pulsar
-
Notifications
You must be signed in to change notification settings - Fork 0
/
siteConfig.js
212 lines (186 loc) · 7.16 KB
/
siteConfig.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
const {Plugin: Embed} = require('remarkable-embed');
// Our custom remarkable plugin factory.
const createVariableInjectionPlugin = variables => {
// `let` binding used to initialize the `Embed` plugin only once for efficiency.
// See `if` statement below.
let initializedPlugin;
const embed = new Embed();
embed.register({
// Call the render method to process the corresponding variable with
// the passed Remarkable instance.
// -> the Markdown markup in the variable will be converted to HTML.
inject: (key) => {
keyparts = key.split(":");
// javadoc:<name>:<url_path>
if (keyparts[0] == 'javadoc') {
return renderUrl(initializedPlugin, javadocUrl, keyparts);
// githubUrl:<name>:<path>
} else if (keyparts[0] == 'github') {
return renderUrl(initializedPlugin, githubUrl + "/tree/master/", keyparts);
// rest api: rest:<name>:<path>
} else if (keyparts[0] == 'rest') {
return renderUrl(initializedPlugin, restApiUrl + "#", keyparts);
} else if (keyparts[0] == 'functions') {
return renderUrl(initializedPlugin, functionsApiUrl + "#", keyparts);
} else if (keyparts[0] == 'source') {
return renderUrl(initializedPlugin, sourceApiUrl + "#", keyparts);
} else if (keyparts[0] == 'sink') {
return renderUrl(initializedPlugin, sinkApiUrl + "#", keyparts);
} else if (keyparts[0] == 'packages') {
return renderUrl(initializedPlugin, packagesApiUrl + "#", keyparts);
} else {
keyparts = key.split("|");
// endpoint api: endpoint|<op>
if (keyparts[0] == 'endpoint') {
const restPath = keyparts[2].split('/')
const restApiVersion = restPath[2]
const restApiType = restPath[3]
let restBaseUrl = restApiUrl
if (restApiType == 'functions') {
restBaseUrl = functionsApiUrl
} else if (restApiType == 'source') {
restBaseUrl = sourceApiUrl
} else if (restApiType == 'sink') {
restBaseUrl = sinkApiUrl
}
const suffix = keyparts[keyparts.length - 1]
restUrl = ''
if (suffix.indexOf('?version') >= 0) {
restUrl = keyparts[keyparts.length - 1] + '&apiVersion=' + restApiVersion
} else {
restUrl = keyparts[keyparts.length - 1] + 'version=master&apiVersion=' + restApiVersion
}
return renderEndpoint(initializedPlugin, restBaseUrl + "#", keyparts, restUrl);
}
}
return initializedPlugin.render(variables[key])
}
});
return (md, options) => {
if (!initializedPlugin) {
initializedPlugin = {
render: md.render.bind(md),
hook: embed.hook(md, options)
};
}
return initializedPlugin.hook;
};
};
const renderUrl = (initializedPlugin, baseUrl, keyparts) => {
content = '[' + keyparts[1] + '](' + baseUrl + keyparts[2] + ')';
rendered_content = initializedPlugin.render(content);
rendered_content = rendered_content.replace('<p>', '');
rendered_content = rendered_content.replace('</p>', '');
return rendered_content;
};
const renderEndpoint = (initializedPlugin, baseUrl, keyparts, restUrl) => {
content = '[<b>' + keyparts[1] + '</b> <i>' + keyparts[2] + '</i>](' + baseUrl + restUrl + ')';
rendered_content = initializedPlugin.render(content);
rendered_content = rendered_content.replace('<p>', '');
rendered_content = rendered_content.replace('</p>', '');
return rendered_content;
};
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 githubUrl = 'https://github.com/apache/pulsar';
const baseUrl = '/';
const siteVariables = {
};
const siteConfig = {
title: 'Apache Pulsar' /* title for your website */,
disableTitleTagline: true,
tagline: '',
url: url /* your website url */,
baseUrl: baseUrl /* base url for your project */,
// For github.io type URLs, you would set the url and baseUrl like:
// url: 'https://facebook.github.io',
// baseUrl: '/test-site/',
editUrl: `${githubUrl}/edit/master/site2/docs/`,
// Used for publishing and more
projectName: 'pulsar',
organizationName: 'apache',
// For top-level user or org sites, the organization is still the same.
// e.g., for the https://JoelMarcey.github.io site, it would be set like...
// organizationName: 'JoelMarcey'
// For no header links in the top nav bar -> headerLinks: [],
headerLinks: [
{doc: 'standalone', label: 'Docs'},
{page: 'download', label: 'Download'},
{doc: 'client-libraries', label: 'Clients'},
{href: '#restapis', label: 'REST APIs'},
{href: '#cli', label: 'Cli'},
{blog: true, label: 'Blog'},
{href: '#community', label: 'Community'},
{href: '#apache', label: 'Apache'},
// Determines search bar position among links
//{ search: true },
// Determines language drop down position among links
{ languages: true }
],
// If you have users set above, you add it here:
users: [],
/* path to images for header/footer */
headerIcon: 'img/pulsar.svg',
footerIcon: 'img/pulsar.svg',
favicon: 'img/pulsar.ico',
algolia: {
apiKey: 'd226a455cecdd4bc18a554c1b47e5b52',
indexName: 'apache_pulsar',
algoliaOptions: {
facetFilters: ['language:LANGUAGE', 'version:VERSION'],
},
},
gaTrackingId: 'UA-102219959-1',
/* colors for website */
colors: {
primaryColor: '#188fff',
secondaryColor: '#205C3B',
},
translationRecruitingLink: 'https://crowdin.com/project/apache-pulsar',
// This copyright info is used in /core/Footer.js and blog rss/atom feeds.
copyright:
'Copyright © ' +
new Date().getFullYear() +
' The Apache Software Foundation. All Rights Reserved.' +
' Apache, Apache Pulsar and the Apache feather logo are trademarks of The Apache Software Foundation.',
highlight: {
// Highlight.js theme to use for syntax highlighting in code blocks
theme: 'atom-one-dark',
},
// Add custom scripts here that would be placed in <script> tags
scripts: [
'https://buttons.github.io/buttons.js',
'https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.0/clipboard.min.js',
`${baseUrl}js/custom.js`
],
stylesheets: [
`${baseUrl}css/code-blocks-buttons.css`
],
/* On page navigation for the current documentation page */
onPageNav: 'separate',
/* Open Graph and Twitter card images */
//ogImage: 'img/docusaurus.png',
twitter: true,
twitterUsername: 'apache_pulsar',
twitterImage: 'img/pulsar.svg',
disableHeaderTitle: true,
cleanUrl: true,
//scrollToTop: true,
scrollToTopOptions: {
zIndex: 100,
},
githubUrl: githubUrl,
projectDescription: `
Apache Pulsar is a cloud-native, distributed messaging and streaming platform originally
created at Yahoo! and now a top-level Apache Software Foundation project
`,
markdownPlugins: [
createVariableInjectionPlugin(siteVariables)
],
};
module.exports = siteConfig;