-
Notifications
You must be signed in to change notification settings - Fork 514
Expand file tree
/
Copy pathdocusaurus.config.js
More file actions
403 lines (387 loc) · 18.2 KB
/
docusaurus.config.js
File metadata and controls
403 lines (387 loc) · 18.2 KB
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
// @ts-check
// Note: type annotations allow type checking and IDEs autocompletion
const dotenv = require("dotenv");
dotenv.config({ path: ".env.local" });
const versions = require("./versions.json");
const lightCodeTheme = require("./codeblock-theme");
const darkCodeTheme = require("prism-react-renderer/themes/dracula");
const simplePlantUML = require("@akebifiky/remark-simple-plantuml");
const tailwindPlugin = require("./plugins/tailwind");
const matomoPlugin = require("./plugins/matomo");
const customWebpack = require("./plugins/custom-webpack");
const externalRedirectsPlugin = require("./plugins/external-redirects");
const math = require("remark-math");
const katex = require("rehype-katex");
const {
getSplatRedirects,
getRedirects,
getExactUrlRedirects,
getExternalRedirects,
} = require("./plugins/utils/redirects");
const fs = require("fs");
const remarkPlugins = [
math,
simplePlantUML,
require("remark-code-import"),
require("./plugins/remark/validate-links.js"),
];
const rehypePlugins = [katex];
const isDeployPreview = !!process.env.PREVIEW_CANISTER_ID;
if (process.env.PREVIEW_CANISTER_ID) {
console.log("PREVIEW_CANISTER_ID:", process.env.PREVIEW_CANISTER_ID);
}
const navbarItems = [
{
type: "search",
position: "right",
},
];
const subnavItems = [
{
type: "doc",
position: "left",
docId: "home",
label: "Home",
},
{
type: "docSidebar",
position: "left",
sidebarId: "build",
label: "Building apps",
activeBasePath: "/build/",
},
{
type: "docSidebar",
position: "left",
sidebarId: "defi",
label: "DeFi",
activeBasePath: "/defi/",
},
{
type: "docSidebar",
position: "left",
sidebarId: "btc",
label: "Build on Bitcoin",
activeBasePath: "/build-on-btc/",
},
{
type: "docSidebar",
position: "left",
sidebarId: "motoko",
label: "Motoko",
activeBasePath: "/motoko/",
},
{
type: "docSidebar",
position: "left",
sidebarId: "references",
label: "References",
activeBasePath: "/references/",
},
{
type: "dropdown",
position: "left",
label: "Resources",
items: [
{
label: "SDK Release Notes",
type: "doc",
docId: "other/updates/release-notes/release-notes",
},
{
label: "Awesome Internet Computer",
href: "https://github.com/dfinity/awesome-internet-computer#readme",
},
{
label: "ICP Ninja",
href: "https://icp.ninja",
},
{
label: "ICP Developer Forum",
href: "https://forum.dfinity.org/",
},
{
label: "ICP Developer Discord",
href: "https://discord.internetcomputer.org",
},
{
label: "DFINITYDev on X",
href: "https://x.com/DFINITYDev",
},
{
label: "Developer Grants",
href: "https://dfinity.org/grants"
}
],
},
/**
* Add UI tests in development mode
* process.env.NODE_ENV === "development" && {
* label: "UI Tests",
* href: "/docs/tests/all",
*/
].filter(Boolean);
function getImageDataUrl(url) {
return `data:image/svg+xml;base64,${fs.readFileSync(url).toString("base64")}`;
}
/** @type {import("@docusaurus/types").Config} */
const config = {
title: "Internet Computer",
tagline:
"The Internet Computer hosts secure, network-resident code and data. Build web apps without Big Tech and current IT. Applications are immune to cyber attacks and unstoppable, capable of processing tokens, and can run under exclusive DAO control. Build web3 social media, games, DeFi, multichain apps, secure front-ends, ledgers, enterprise apps, and AI models. TCP/IP connected software. Now ICP hosts software.",
url: isDeployPreview
? `https://${process.env.PREVIEW_CANISTER_ID}.icp0.io`
: "https://internetcomputer.org",
baseUrl: "/",
onBrokenLinks: "warn",
onBrokenMarkdownLinks: "warn",
favicon: "img/favicon-32x32.png",
organizationName: "dfinity",
projectName: "portal",
customFields: {
searchCanisterId: "5qden-jqaaa-aaaam-abfpa-cai",
},
markdown: {
mermaid: true,
},
scripts: [
{
src: "https://widget.kapa.ai/kapa-widget.bundle.js",
"data-website-id": "73cafe70-9be1-494b-bd31-b849fc29799f",
"data-bot-protection-mechanism": "hcaptcha",
"data-project-name": "Internet Computer",
"data-project-color": "#172234",
"data-project-logo":
"https://s3.coinmarketcap.com/static-gravity/image/2fb1bc84c1494178beef0822179d137d.png",
"data-modal-override-open-class": "ask-ai-widget-trigger",
"data-modal-ask-ai-input-placeholder":
"Ask me a question about the Internet Computer Protocol",
"data-modal-example-questions":
"What is the ICP token?, How is the Internet Computer governed?, How do I start building fully onchain Web3?",
"data-modal-disclaimer":
" This LLM provides responses are generated automatically and may be inaccurate or outdated. Please take care to verify or validate any responses before making any critical decisions.",
"data-user-analytics-fingerprint-enabled": "true",
"data-modal-z-index": "1001",
async: true,
"data-button-hide": "true",
},
],
plugins: [
"docusaurus-plugin-sass",
customWebpack,
tailwindPlugin,
matomoPlugin,
externalRedirectsPlugin({
redirects: [...getExternalRedirects(), ...getExactUrlRedirects()],
}),
[
"@docusaurus/plugin-client-redirects",
{
fromExtensions: ["html", "md"],
redirects: getRedirects(),
createRedirects: (existingPath) => getSplatRedirects(existingPath),
},
],
],
presets: [
[
"classic",
/** @type {import("@docusaurus/preset-classic").Options} */
({
docs: {
path: "docs",
routeBasePath: "/",
lastVersion: versions[0],
showLastUpdateAuthor: true,
showLastUpdateTime: true,
breadcrumbs: false,
exclude: [
"references/samples/ADDING_AN_EXAMPLE.md",
"references/samples/archive/**",
"references/samples/c/**",
"references/samples/hosting/README.md",
"references/samples/hosting/godot-html5-template/**",
"references/samples/hosting/react/**",
"references/samples/hosting/unity-webgl-template/**",
"references/samples/native-apps/**",
"references/samples/svelte/**",
"references/samples/wasm/**",
"motoko/old/**",
],
sidebarPath: require.resolve("./sidebars.js"),
remarkPlugins,
rehypePlugins,
editUrl: "https://github.com/dfinity/portal/edit/master/",
},
blog: false,
theme: {
customCss: require.resolve("./src/css/custom.scss"),
},
}),
],
],
// TODO: Remove when ready to integrate internationalization
// i18n: {
// defaultLocale: 'en',
// locales: isDeployPreview
// ? // Deploy preview: keep it fast!
// ['en']
// : ['en', 'fr'],
// },
themeConfig:
// NOTE: liveCodeBLock is enabled for possible future feature,
// but to do that type preset- classic had to be disabled below
// /** @type {import('@docusaurus/preset-classic').ThemeConfig} */
{
image: "/img/share.webp",
colorMode: {
disableSwitch: false,
defaultMode: "light",
respectPrefersColorScheme: true,
},
// github codeblock theme configuration
codeblock: {
showGithubLink: true,
githubLinkLabel: "View on GitHub",
showRunmeLink: false,
runmeLinkLabel: "Checkout via Runme",
},
metadata: [
{
// ios safari zooms in when an input field is focused
// maximum-scale=1 solves the issue
name: "viewport",
content: "width=device-width, initial-scale=1, maximum-scale=5",
},
],
navbar: {
hideOnScroll: true,
logo: {
alt: "DFINITY Logo",
src: "/img/IC_logo_horizontal.svg",
},
// subnav redeclared to show up in mobile menu
items: [...navbarItems, ...subnavItems],
},
subnav: {
items: subnavItems,
},
footer: {
links: [
{
items: [
{
label: "Dashboard",
href: "https://dashboard.internetcomputer.org/",
},
{
label: "Learn Hub",
href: "https://learn.internetcomputer.org/",
},
{
label: "Node Providers",
href: "https://internetcomputer.org/node-providers",
},
{
label: "Developer Grants",
href: "https://dfinity.org/grants"
},
],
},
{
items: [
{
label: "Support & Feedback",
href: "https://support.dfinity.org/hc/en-us",
},
{
label: "Brand Materials",
href: "https://dfinity.frontify.com/d/pD7yZhsmpqos",
},
{
label: "Press Kit",
href: "https://dfinity.frontify.com/d/pD7yZhsmpqos/press-kit",
},
],
},
{
title: "SocialMedia",
items: [
{
label: "X",
to: "https://twitter.com/dfinity",
iconLight: getImageDataUrl(
"./static/img/svgIcons/purple/twitter.svg"
),
icon: `data:image/svg+xml;base64,${fs
.readFileSync("./static/img/svgIcons/twitter-white.svg")
.toString("base64")}`,
},
{
label: "Telegram",
to: "https://t.me/+m8tiEFaaNR8xNjNl",
iconLight: getImageDataUrl(
"./static/img/svgIcons/purple/telegram.svg"
),
icon: `data:image/svg+xml;base64,${fs
.readFileSync("./static/img/svgIcons/telegram-white.svg")
.toString("base64")}`,
},
{
label: "Medium",
to: "https://medium.com/dfinity",
icon: "data:image/svg+xml,%3Csvg width='24px' height='24px' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='white' d='m24 24h-24v-24h24zm-8.986-15.006v7.326c0 .198 0 .234-.127.362l-1.302 1.264v.27h6.32v-.27l-1.257-1.234c-.091-.07-.148-.178-.148-.3 0-.022.002-.043.005-.064v.002-9.07c-.003-.019-.005-.04-.005-.062 0-.121.058-.229.148-.298l.001-.001 1.286-1.234v-.27h-4.456l-3.176 7.924-3.609-7.924h-4.675v.271l1.502 1.813c.127.115.207.281.207.466 0 .022-.001.043-.003.064v-.003 7.126c.007.041.011.088.011.136 0 .222-.088.423-.231.571l-1.69 2.054v.27h4.8v-.27l-1.691-2.054c-.149-.154-.241-.363-.241-.595 0-.04.003-.079.008-.117v.004-6.16l4.215 9.195h.49z'/%3E%3C/svg%3E",
iconLight: getImageDataUrl(
"./static/img/svgIcons/purple/medium.svg"
),
},
{
label: "Youtube",
to: "https://www.youtube.com/dfinity",
icon: "data:image/svg+xml,%3C%3Fxml version='1.0' encoding='iso-8859-1'%3F%3E%3C!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --%3E%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' width='24' height='24' viewBox='0 0 310 310' style='enable-background:new 0 0 310 310;' xml:space='preserve'%3E%3Cg id='XMLID_822_'%3E%3Cpath id='XMLID_823_' fill='white' d='M297.917,64.645c-11.19-13.302-31.85-18.728-71.306-18.728H83.386c-40.359,0-61.369,5.776-72.517,19.938 C0,79.663,0,100.008,0,128.166v53.669c0,54.551,12.896,82.248,83.386,82.248h143.226c34.216,0,53.176-4.788,65.442-16.527 C304.633,235.518,310,215.863,310,181.835v-53.669C310,98.471,309.159,78.006,297.917,64.645z M199.021,162.41l-65.038,33.991 c-1.454,0.76-3.044,1.137-4.632,1.137c-1.798,0-3.592-0.484-5.181-1.446c-2.992-1.813-4.819-5.056-4.819-8.554v-67.764 c0-3.492,1.822-6.732,4.808-8.546c2.987-1.814,6.702-1.938,9.801-0.328l65.038,33.772c3.309,1.718,5.387,5.134,5.392,8.861 C204.394,157.263,202.325,160.684,199.021,162.41z'/%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3Cg%3E%3C/g%3E%3C/svg%3E%0A",
iconLight: getImageDataUrl(
"./static/img/svgIcons/purple/youtube.svg"
),
},
{
label: "Reddit",
to: "https://www.reddit.com/r/dfinity/",
icon: "data:image/svg+xml,%3Csvg width='24px' height='24px' viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cg%3E%3Cpath fill='none' d='M0 0h24v24H0z'/%3E%3Cpath fill-rule='nonzero' fill='white' d='M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10-4.477 10-10 10zm6.67-10a1.46 1.46 0 0 0-2.47-1 7.12 7.12 0 0 0-3.85-1.23L13 6.65l2.14.45a1 1 0 1 0 .13-.61L12.82 6a.31.31 0 0 0-.37.24l-.74 3.47a7.14 7.14 0 0 0-3.9 1.23 1.46 1.46 0 1 0-1.61 2.39 2.87 2.87 0 0 0 0 .44c0 2.24 2.61 4.06 5.83 4.06s5.83-1.82 5.83-4.06a2.87 2.87 0 0 0 0-.44 1.46 1.46 0 0 0 .81-1.33zm-10 1a1 1 0 1 1 2 0 1 1 0 0 1-2 0zm5.81 2.75a3.84 3.84 0 0 1-2.47.77 3.84 3.84 0 0 1-2.47-.77.27.27 0 0 1 .38-.38A3.27 3.27 0 0 0 12 16a3.28 3.28 0 0 0 2.09-.61.28.28 0 1 1 .39.4v-.04zm-.18-1.71a1 1 0 1 1 1-1 1 1 0 0 1-1.01 1.04l.01-.04z'/%3E%3C/g%3E%3C/svg%3E%0A",
iconLight: getImageDataUrl(
"./static/img/svgIcons/purple/reddit.svg"
),
},
{
label: "CoinMarketCap",
to: "https://coinmarketcap.com/currencies/internet-computer/",
icon: "data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20.1307 14.3432C19.9566 14.4632 19.7533 14.534 19.5423 14.5481C19.3313 14.5623 19.1204 14.5193 18.9318 14.4237C18.489 14.1735 18.2504 13.587 18.2504 12.7878V10.3382C18.2504 9.16231 17.7846 8.32567 17.0055 8.09854C15.6887 7.71328 14.7054 9.32619 14.3259 9.93283L11.9971 13.702V9.10193C11.9712 8.04104 11.6262 7.40565 10.9736 7.21589C10.5423 7.08939 9.89545 7.14114 9.26581 8.10141L4.05907 16.4592C3.36629 15.1338 3.00708 13.6594 3.01255 12.1639C3.01255 7.12676 7.03764 3.0298 11.9971 3.0298C16.9566 3.0298 20.9961 7.12676 20.9961 12.1639V12.1898C20.9961 12.1898 20.9961 12.207 20.9961 12.2156C21.045 13.1903 20.7287 13.9665 20.1336 14.3432H20.1307ZM23.0058 12.1668V12.1179C22.9655 5.97961 18.0434 1 11.9971 1C5.95086 1 1 6.00836 1 12.1639C1 18.3194 5.93361 23.3306 11.9971 23.3306C14.7781 23.3305 17.4533 22.2645 19.4723 20.3521C19.6683 20.1674 19.7836 19.913 19.7933 19.6439C19.803 19.3748 19.7062 19.1128 19.524 18.9145C19.4369 18.8181 19.3315 18.7399 19.2139 18.6843C19.0964 18.6287 18.969 18.597 18.8392 18.5908C18.7093 18.5847 18.5795 18.6043 18.4572 18.6485C18.335 18.6927 18.2227 18.7606 18.1268 18.8484C17.2575 19.673 16.2306 20.3133 15.1077 20.7311C13.9848 21.1489 12.7891 21.3355 11.5923 21.2796C10.3955 21.2238 9.22229 20.9267 8.14317 20.4061C7.06406 19.8856 6.10127 19.1523 5.3126 18.2504L9.99895 10.7177V14.1937C9.99895 15.8641 10.6458 16.4046 11.1892 16.5627C11.7326 16.7209 12.5635 16.6116 13.4347 15.1971L16.0222 11.0081C16.1027 10.873 16.1803 10.758 16.2493 10.6573V12.7878C16.2493 14.3489 16.8761 15.5967 17.9744 16.212C18.4738 16.4816 19.0365 16.6118 19.6036 16.5891C20.1707 16.5663 20.7212 16.3914 21.1973 16.0826C22.4049 15.2977 23.0633 13.8774 22.9943 12.1668H23.0058Z' fill='white'/%3E%3C/svg%3E%0A",
iconLight: getImageDataUrl(
"./static/img/svgIcons/purple/coinmarketcap.svg"
),
},
{
label: "Discord",
to: "https://discord.internetcomputer.org",
icon: "data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E %3Cpath%20d%3D%22M19.3034%205.33716C17.9344%204.71103%2016.4805%204.2547%2014.9629%204C14.7719%204.32899%2014.5596%204.77471%2014.411%205.12492C12.7969%204.89144%2011.1944%204.89144%209.60255%205.12492C9.45397%204.77471%209.2311%204.32899%209.05068%204C7.52251%204.2547%206.06861%204.71103%204.70915%205.33716C1.96053%209.39111%201.21766%2013.3495%201.5891%2017.2549C3.41443%2018.5815%205.17612%2019.388%206.90701%2019.9187C7.33151%2019.3456%207.71356%2018.73%208.04255%2018.0827C7.41641%2017.8492%206.82211%2017.5627%206.24904%2017.2231C6.39762%2017.117%206.5462%2017.0003%206.68416%2016.8835C10.1438%2018.4648%2013.8911%2018.4648%2017.3082%2016.8835C17.4568%2017.0003%2017.5948%2017.117%2017.7434%2017.2231C17.1703%2017.5627%2016.576%2017.8492%2015.9499%2018.0827C16.2789%2018.73%2016.6609%2019.3456%2017.0854%2019.9187C18.8152%2019.388%2020.5875%2018.5815%2022.4033%2017.2549C22.8596%2012.7341%2021.6806%208.80747%2019.3034%205.33716ZM8.5201%2014.8459C7.48007%2014.8459%206.63107%2013.9014%206.63107%2012.7447C6.63107%2011.5879%207.45884%2010.6434%208.5201%2010.6434C9.57071%2010.6434%2010.4303%2011.5879%2010.4091%2012.7447C10.4091%2013.9014%209.57071%2014.8459%208.5201%2014.8459ZM15.4936%2014.8459C14.4535%2014.8459%2013.6034%2013.9014%2013.6034%2012.7447C13.6034%2011.5879%2014.4323%2010.6434%2015.4936%2010.6434C16.5442%2010.6434%2017.4038%2011.5879%2017.3825%2012.7447C17.3825%2013.9014%2016.5548%2014.8459%2015.4936%2014.8459Z%22%20fill%3D%22white%22%20%2F%3E %3C%2Fsvg%3E",
iconLight: getImageDataUrl(
"./static/img/svgIcons/purple/discord.svg"
),
},
],
},
],
copyright: `© ${new Date().getFullYear()} Internet Computer`,
},
prism: {
theme: lightCodeTheme,
darkTheme: darkCodeTheme,
additionalLanguages: ["rust"],
},
liveCodeBlock: {
playgroundPosition: "bottom",
},
},
themes: ["@saucelabs/theme-github-codeblock", "@docusaurus/theme-mermaid"],
clientModules: [require.resolve("./static/load_moc.ts")],
};
module.exports = config;