-
Notifications
You must be signed in to change notification settings - Fork 603
/
docusaurus.config.js
211 lines (198 loc) · 6.27 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
// @ts-check
// Note: type annotations allow type checking and IDEs autocompletion
import {themes as prismThemes} from 'prism-react-renderer';
/** @type {import('@docusaurus/types').Config} */
const config = {
title: 'Chisel',
tagline: 'Software-defined hardware',
favicon: 'img/chisel-tool-icon.svg',
// Set the production url of your site here
url: 'https://www.chisel-lang.org',
// Set the /<baseUrl>/ pathname under which your site is served
// For GitHub pages deployment, it is often '/<projectName>/'
baseUrl: '/',
// Github pages adds trailing slashes by default, we cannot leave this
// undefined or the Algolia webcrawler won't work.
// One side-effect of making it false is that markdown files that have the
// same name as their parent directory or have the name `index.md` now map
// to `<parent directory>.html`. This means that any links they have to other
// markdown files in the same directory now need to include the directory
// path. For example:
//
// docs
// └── foo
// ├── foo.md (or index.md)
// ├── bar.md
// └── fizz.md
//
// This maps to the following .html:
// docs
// ├── foo.html
// └── foo
// ├── bar.html
// └── fizz.html
//
// A link from bar.md to fizz.md is [link](fizz).
// A link from foo.md to fizz.md is [link](foo/fizz).
trailingSlash: false,
// GitHub pages deployment config.
organizationName: 'chipsalliance',
projectName: 'chisel',
onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'throw',
onBrokenAnchors: 'throw',
// 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'],
},
presets: [
[
'classic',
({
docs: {
sidebarPath: require.resolve('./sidebars.js'),
// Use function to avoid extra 'docs/' in relative path of doc
editUrl: (params) => {
return (
'https://github.com/chipsalliance/chisel/tree/main/docs/src/' +
params.docPath
);
},
},
theme: {
customCss: require.resolve('./src/css/custom.css'),
},
}),
],
],
themeConfig:
({
image: 'img/chisel-tool.svg',
navbar: {
title: 'Chisel',
logo: {
alt: 'Chisel Logo',
src: 'img/chisel-tool.svg',
},
items: [
{to: '/docs', label: 'Docs', position: 'left'},
{to: '/community', label: 'Community', position: 'left'},
{to: '/api', label: 'API', position: 'left'},
{
href: 'https://www.chipsalliance.org/',
position: 'right',
className: 'header-chipsalliance-link',
'aria-label': 'ChipsAlliance link',
},
{
href: 'https://github.com/chipsalliance/chisel',
position: 'right',
className: 'header-github-link',
'aria-label': 'GitHub repository',
},
],
},
footer: {
style: 'dark',
links: [
{
title: 'Docs',
items: [
{
label: 'Docs',
to: '/docs',
},
{
label: 'ScalaDoc',
// pathname is needed by Docusaurus to correctly handle
// internal links in the static folder, see
// https://docusaurus.io/docs/advanced/routing#escaping-from-spa-redirects
to: 'pathname:///api/latest',
}
],
},
{
title: 'Community',
items: [
{
label: 'Stack Overflow',
href: 'https://stackoverflow.com/questions/tagged/chisel',
},
{
label: 'Gitter',
href: 'https://gitter.im/freechipsproject/chisel3',
},
{
label: 'Twitter',
href: 'https://twitter.com/chisel_lang',
},
],
},
{
title: 'More',
items: [
{
label: 'GitHub',
href: 'https://github.com/chipsalliance/chisel',
},
],
},
],
copyright: `Copyright © ${new Date().getFullYear()} ChipsAlliance. Built with Docusaurus.`,
},
prism: {
theme: prismThemes.github,
darkTheme: prismThemes.dracula,
additionalLanguages: [
'bash',
// The Scala grammar extends the java one
// prism requires manually loading java first
'java',
'scala',
'verilog',
],
},
// Algolia search integration: https://docusaurus.io/docs/search
algolia: {
appId: 'TTFNIAC3CJ',
apiKey: '6a4ec6ef68c7b32aca79adf7440604ca',
indexName: 'chisel-lang',
// When true, this adds facets which (with default settings) break search results
// It is probably fixable, see: https://docusaurus.io/docs/search#contextual-search
contextualSearch: false,
searchPagePath: 'search',
insights: true,
},
}),
plugins: [
[
'@docusaurus/plugin-client-redirects',
{ // Clean up links including .html, /myPages.html -> /myPage
fromExtensions: ['html', 'htm'],
redirects: [
{ // Redirect old chisel3 docs landing page
from: '/chisel3',
to: '/docs',
},
],
createRedirects(to) {
// Redirect from all /chisel3/docs/X links to /docs/X
// This catches many broken links from old sbt-microsites website
if (to.includes('/docs')) {
const from1 = to.replace('/docs', '/chisel3/docs');
// Include redirects for .html/.htm because fromExtensions does not
// compose with these redirects automatically.
const from2 = from1.concat(".html");
const from3 = from1.concat(".htm");
return [from1, from2, from3];
}
return undefined;
},
},
],
],
};
module.exports = config;