forked from OffchainLabs/arbitrum-docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocusaurus.config.js
More file actions
468 lines (447 loc) · 13.9 KB
/
docusaurus.config.js
File metadata and controls
468 lines (447 loc) · 13.9 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
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
// @ts-nocheck
// Note: type annotations allow type checking and IDEs autocompletion
require('dotenv').config();
const markdownPreprocessor = require('./scripts/markdown-preprocessor');
const sdkCodebasePath = './submodules/arbitrum-sdk';
import remarkMath from 'remark-math';
import rehypeKatex from 'rehype-katex';
// Inkeep analytics event handler - forwards events to PostHog
const handleInkeepEvent = (event) => {
// Only run on client side where PostHog is available
if (typeof window === 'undefined' || !window.posthog) {
return;
}
const { eventName, properties } = event;
// Events we want to track in PostHog
const trackedEvents = [
// Chat events
'assistant_message_received',
'user_message_submitted',
'assistant_positive_feedback_submitted',
'assistant_negative_feedback_submitted',
'assistant_source_item_clicked',
'chat_share_button_clicked',
// Search events
'search_query_submitted',
'search_result_clicked',
'search_query_response_received',
];
if (trackedEvents.includes(eventName)) {
// Extract relevant properties to avoid sending excessive data
const eventProperties = {
component_type: properties?.componentType,
widget_version: properties?.widgetLibraryVersion,
};
// Add event-specific properties
if (eventName.includes('search')) {
eventProperties.search_query = properties?.searchQuery;
if (properties?.totalResults !== undefined) {
eventProperties.total_results = properties.totalResults;
}
if (properties?.title) {
eventProperties.result_title = properties.title;
}
}
if (eventName.includes('feedback')) {
eventProperties.feedback_reasons = properties?.reasons;
}
if (eventName === 'assistant_source_item_clicked') {
eventProperties.source_link = properties?.link;
}
window.posthog.capture(`inkeep_${eventName}`, eventProperties);
}
};
// Shared Inkeep configuration
const inkeepBaseSettings = {
apiKey: process.env.INKEEP_API_KEY,
primaryBrandColor: '#213147',
organizationDisplayName: 'Arbitrum',
onEvent: handleInkeepEvent,
theme: {
syntaxHighlighter: {
lightTheme: require('prism-react-renderer/themes/github'),
darkTheme: require('prism-react-renderer/themes/palenight'),
},
},
};
const inkeepModalSettings = {
placeholder: 'Search documentation...',
defaultQuery: '',
maxResults: 40,
debounceTimeMs: 300,
shouldOpenLinksInNewTab: true,
};
const inkeepExampleQuestions = [
'How to estimate gas in Arbitrum?',
'What is the difference between Arbitrum One and Nova?',
'How to deploy a smart contract on Arbitrum?',
'What are Arbitrum Orbit chains?',
'How does Arbitrum handle L1 to L2 messaging?',
'What is Arbitrum Stylus?',
];
/** @type {import('@docusaurus/types').Config} */
const config = {
title: 'Arbitrum Docs',
tagline: 'Arbitrum Docs',
url: 'https://docs.arbitrum.io/',
baseUrl: '/',
onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'throw',
favicon: 'img/logo.svg',
markdown: {
mermaid: true,
preprocessor: markdownPreprocessor,
parseFrontMatter: async (params) => {
// Use the default parser
const result = await params.defaultParseFrontMatter(params);
// Check if this is a partial file (starts with underscore)
const fileName = params.filePath.split('/').pop();
const isPartialFile = fileName && fileName.startsWith('_');
// For partial files, clear frontmatter to prevent Docusaurus warnings
// The documentation-graph tool reads raw files directly, so this doesn't affect analysis
if (isPartialFile) {
result.frontMatter = {};
}
return result;
},
},
themes: ['@docusaurus/theme-mermaid', '@docusaurus/theme-live-codeblock'],
// GitHub pages deployment config.
// If you aren't using GitHub pages, you don't need these.
organizationName: 'OffchainLabs', // Usually your GitHub org/user name.
projectName: 'docusaurus', // Usually your repo name.
// Even if you don't use internalization, you can use this field to set useful
// metadata like html lang. For example, if your site is Chinese, you may want
// to replace "en" with "zh-Hans".
i18n: {
defaultLocale: 'en',
// locales: ['en', 'ja', 'zh'],
locales: ['en'],
},
stylesheets: [
{
href: 'https://cdn.jsdelivr.net/npm/katex@0.13.24/dist/katex.min.css',
type: 'text/css',
integrity: 'sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM',
crossorigin: 'anonymous',
},
],
presets: [
[
'@docusaurus/preset-classic',
/** @type {import('@docusaurus/preset-classic').Options} */
({
docs: {
exclude: ['**/api/**', '**/*.pdf'],
remarkPlugins: [remarkMath],
rehypePlugins: [rehypeKatex],
sidebarPath: require.resolve('./sidebars.js'),
routeBasePath: '/',
breadcrumbs: false,
editUrl: function (s) {
// troubleshooting docs content has external source-of-truth; node-providers uses form-submission
if (s.docPath.includes('troubleshooting') || s.docPath.includes('node-providers'))
return undefined;
return 'https://github.com/OffchainLabs/arbitrum-docs/edit/master/' + s.docPath;
},
showLastUpdateTime: true,
},
theme: {
customCss: require.resolve('./src/css/custom.scss'),
},
}),
],
],
plugins: [
[
'docusaurus-plugin-typedoc',
{
id: 'arbitrum-sdk',
tsconfig: `${sdkCodebasePath}/tsconfig.json`,
entryPoints: [`${sdkCodebasePath}/src/lib`],
entryPointStrategy: 'expand',
exclude: [`abi`, `node_modules`, `tests`, `scripts`],
excludeNotDocumented: true,
excludeInternal: true,
excludeExternals: true,
readme: 'none',
// Output options
out: './docs/sdk',
cleanOutputDir: false, // Don't clean output dir to preserve manual files
hideGenerator: true,
validation: {
notExported: false,
invalidLink: true,
notDocumented: true,
},
skipErrorChecking: true,
logLevel: 'Verbose',
sidebar: {
autoConfiguration: false,
},
plugin: [
'typedoc-plugin-markdown',
`typedoc-plugin-frontmatter`,
'./scripts/sdkDocsHandler.ts',
],
// typedoc-plugin-markdown options
// Reference: https://github.com/tgreyuk/typedoc-plugin-markdown/blob/next/packages/typedoc-plugin-markdown/docs/usage/options.md
outputFileStrategy: 'modules',
excludeGroups: false,
hidePageHeader: true,
hidePageTitle: true,
hideBreadcrumbs: true,
useCodeBlocks: true,
expandParameters: true,
parametersFormat: 'table',
propertiesFormat: 'table',
enumMembersFormat: 'table',
typeDeclarationFormat: 'table',
sanitizeComments: true,
frontmatterGlobals: {
layout: 'docs',
sidebar: true,
toc_max_heading_level: 5,
},
},
],
[
'@inkeep/cxkit-docusaurus',
{
SearchBar: {
baseSettings: inkeepBaseSettings,
modalSettings: inkeepModalSettings,
aiChatSettings: {
aiAssistantAvatar: '/img/logo.svg',
exampleQuestions: inkeepExampleQuestions,
botName: 'Arbitrum Assistant',
getStartedMessage:
"Hi! I'm here to help you navigate Arbitrum documentation. Ask me anything about building on Arbitrum, deploying contracts, or understanding our technology.",
},
},
ChatButton: {
baseSettings: inkeepBaseSettings,
modalSettings: inkeepModalSettings,
aiChatSettings: {
aiAssistantAvatar: '/img/logo.svg',
exampleQuestions: inkeepExampleQuestions,
},
},
},
],
[
'posthog-docusaurus',
{
apiKey: 'phc_AscFTQ876SsPAVMgxMmLn0EIpxdcRRq0XmJWnpG1SHL',
appUrl: 'https://app.posthog.com',
enableInDevelopment: false,
persistence: 'memory',
disable_session_recording: true,
},
],
require.resolve('docusaurus-plugin-fathom'),
require.resolve('docusaurus-plugin-sass'),
],
themeConfig:
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
({
fathomAnalytics: {
siteId: 'DOHOZGJO',
},
announcementBar: {
backgroundColor: '#e3246e',
textColor: 'white',
content:
'Reactivate your Stylus contracts to ensure they remain callable - <a href="https://docs.arbitrum.io/stylus/gentle-introduction#activation" target="_blank">here’s how to do it.</a>',
isCloseable: false,
},
navbar: {
title: 'Arbitrum Docs',
logo: {
alt: 'Arbitrum Logo',
src: 'img/logo.svg',
href: '/get-started/overview',
},
items: [
{
type: 'docSidebar',
sidebarId: 'getStartedSidebar',
position: 'right',
label: 'Get started',
},
{
type: 'dropdown',
label: 'Build apps',
position: 'right',
items: [
{
label: 'Build with Solidity',
to: '/build-decentralized-apps/quickstart-solidity-remix',
},
{
label: 'Build with Stylus',
to: '/stylus/quickstart',
},
],
},
{
type: 'docSidebar',
sidebarId: 'runArbitrumChainSidebar',
position: 'right',
label: 'Launch a chain',
},
{
type: 'docSidebar',
sidebarId: 'runNodeSidebar',
position: 'right',
label: 'Run a node',
},
{
type: 'docSidebar',
sidebarId: 'bridgeSidebar',
position: 'right',
label: 'Use the bridge',
},
{
type: 'docSidebar',
sidebarId: 'howItWorksSidebar',
position: 'right',
label: 'How it works',
},
{
type: 'docSidebar',
sidebarId: 'noticeSidebar',
position: 'right',
label: 'Notices',
},
],
},
footer: {
style: 'dark',
links: [
{
items: [
{
label: 'Arbitrum.io',
to: 'https://arbitrum.io/',
},
{
label: 'Arbitrum Rollup',
to: 'https://arbitrum.io/rollup',
},
{
label: 'Arbitrum AnyTrust',
to: 'https://arbitrum.io/anytrust',
},
{
label: 'Arbitrum chains',
to: 'https://arbitrum.io/launch-chain',
},
{
label: 'Arbitrum Stylus',
to: 'https://arbitrum.io/stylus',
},
{
label: 'Arbitrum Foundation',
to: 'https://arbitrum.foundation/',
},
{
html: '<a href="/nitro-whitepaper.pdf">Arbitrum whitepaper</a>',
},
],
},
{
items: [
{
label: 'Network status',
to: 'https://status.arbitrum.io/',
},
{
label: 'Portal',
to: 'https://portal.arbitrum.io/',
},
{
label: 'Bridge',
to: 'https://bridge.arbitrum.io/',
},
{
label: 'Governance docs',
to: 'https://docs.arbitrum.foundation/',
},
{
label: 'Careers',
to: 'https://offchainlabs.com/careers/',
},
{
label: 'Support',
to: 'https://support.arbitrum.io/',
},
{
label: 'Bug Bounties',
to: 'https://immunefi.com/bounty/arbitrum/',
},
],
},
{
items: [
{
label: 'Discord',
to: 'https://discord.gg/ZpZuw7p',
},
{
label: 'Twitter',
to: 'https://twitter.com/OffchainLabs',
},
{
label: 'Youtube',
to: 'https://www.youtube.com/@Arbitrum',
},
{
label: 'Medium Blog',
to: 'https://medium.com/offchainlabs',
},
{
label: 'Research forum',
to: 'https://research.arbitrum.io/',
},
{
label: 'Privacy Policy',
to: 'https://arbitrum.io/privacy',
},
{
label: 'Terms of Service',
to: 'https://arbitrum.io/tos',
},
],
},
],
copyright: `© ${new Date().getFullYear()} Offchain Labs`,
},
prism: {
additionalLanguages: ['solidity', 'rust', 'bash', 'toml'],
theme: require('prism-react-renderer/themes/github'),
darkTheme: require('prism-react-renderer/themes/palenight'),
},
liveCodeBlock: {
/**
* The position of the live playground, above or under the editor
* Possible values: "top" | "bottom"
*/
playgroundPosition: 'top',
},
mermaid: {
options: {
securityLevel: 'loose',
flowchart: {
curve: 'basis',
},
},
},
docs: {
sidebar: {
autoCollapseCategories: true,
},
},
}),
};
module.exports = config;