Repository navigation
Expand file tree
/
Copy pathdocusaurus.config.ts
More file actions
263 lines (248 loc) · 9.33 KB
/
Copy pathdocusaurus.config.ts
File metadata and controls
263 lines (248 loc) · 9.33 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
import {lightTheme as prismLight, darkTheme as prismDark} from './src/prism/themes';
import type {Config} from '@docusaurus/types';
import type * as Preset from '@docusaurus/preset-classic';
// This runs in Node.js - Don't use client-side code here (browser APIs, JSX...)
// The site's fonts, declared here rather than in src/css/custom.css: a url() in that stylesheet is
// copied to a hashed file name, which the preload below could not name, so the browser would fetch
// the preloaded file and then the hashed one. These rules name the files under static/fonts/.
const FONT_FACES = [
['Inter', '/fonts/inter/inter-latin.woff2', 'normal'],
['Inter', '/fonts/inter/inter-latin-italic.woff2', 'italic'],
['JetBrains Mono', '/fonts/jetbrains-mono/jetbrains-mono-latin.woff2', 'normal'],
]
.map(
([family, url, style]) =>
`@font-face{font-family:'${family}';src:url('${url}') format('woff2');font-weight:400 700;font-style:${style};font-display:swap}`,
)
.join('');
const config: Config = {
title: 'CGP — Context-Generic Programming',
tagline: 'A language extension for Rust, with pluggable trait implementations at compile-time',
favicon: 'img/favicon.png',
// The upright Inter face is preloaded, because every page's text and titles use it. The SVG favicon switches to a
// lighter red on a dark browser tab; the PNG stays as the fallback.
// The theme-color tags match a phone's address bar to the navbar, using the values of `--cgp-bg`
// in src/css/custom.css. Both follow the operating system's colour scheme, which is also the site's
// default.
headTags: [
{tagName: 'style', attributes: {}, innerHTML: FONT_FACES},
{tagName: 'link', attributes: {rel: 'icon', type: 'image/svg+xml', href: '/img/favicon.svg'}},
{
tagName: 'link',
attributes: {
rel: 'preload',
href: '/fonts/inter/inter-latin.woff2',
as: 'font',
type: 'font/woff2',
crossorigin: 'anonymous',
},
},
{
tagName: 'meta',
attributes: {name: 'theme-color', media: '(prefers-color-scheme: light)', content: '#fdfaf7'},
},
{
tagName: 'meta',
attributes: {name: 'theme-color', media: '(prefers-color-scheme: dark)', content: '#0e0c0c'},
},
],
// Future flags, see https://docusaurus.io/docs/api/docusaurus-config#future
future: {
v4: true, // Improve compatibility with the upcoming Docusaurus v4
},
// Set the production url of your site here
url: 'https://contextgeneric.dev',
// Set the /<baseUrl>/ pathname under which your site is served
// For GitHub pages deployment, it is often '/<projectName>/'
baseUrl: '/',
// GitHub Pages serves each page from a directory and redirects a URL without the trailing slash, so
// the sitemap, canonical tags, and links name the slash form that answers directly.
trailingSlash: true,
// GitHub pages deployment config.
// If you aren't using GitHub pages, you don't need these.
organizationName: 'contextgeneric', // Usually your GitHub org/user name.
projectName: 'contextgeneric.dev', // Usually your repo name.
onBrokenLinks: 'throw',
onBrokenAnchors: 'throw',
// Parse `.md` as CommonMark and `.mdx` as MDX, rather than treating every file
// as MDX. The skill pages under `docs/ai/skills/` are symlinks into the
// `cgp-skills` submodule — plain markdown written for coding agents, by a
// repository that has no reason to know about MDX — and MDX would read an
// autolink like `<https://example.com>` as a JSX tag and fail the build. No page
// on this site uses MDX-only syntax (imports, exports, or JSX components), so
// nothing else changes: admonitions and raw HTML work under both.
markdown: {
format: 'detect',
},
// Even if you don't use internationalization, 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'],
},
plugins: [
// Keep webpack from resolving a symlink to its real path. The skill pages
// under `docs/ai/skills/` are symlinks into the `cgp-skills` submodule, whose
// real path sits outside `docs/`; resolved, the compiled module no longer
// matches the metadata the docs plugin registered for the symlink, and every
// such page fails to render with `Cannot read properties of undefined`.
function resolveSymlinkedDocs() {
return {
name: 'resolve-symlinked-docs',
configureWebpack() {
return {resolve: {symlinks: false}};
},
};
},
],
presets: [
[
'@docusaurus/preset-classic',
{
docs: {
showLastUpdateTime: true,
sidebarPath: './sidebars.ts',
// The `cgp-skills` submodule is checked out at the repository root, and
// each skill's pages under `docs/ai/skills/<skill>/` are symlinks into it.
// Its own files are the source, not pages: the ones we publish are reached
// through those symlinks, and the rest (README, AGENTS, sibling-projects)
// are not site content at all.
exclude: ['**/cgp-skills/**'],
// Please change this to your repo.
// Remove this to remove the "edit this page" links.
editUrl:
'https://github.com/contextgeneric/contextgeneric.dev/tree/main/',
},
blog: {
showLastUpdateTime: true,
showReadingTime: true,
feedOptions: {
type: ['rss', 'atom'],
xslt: true,
},
// Please change this to your repo.
// Remove this to remove the "edit this page" links.
editUrl:
'https://github.com/contextgeneric/contextgeneric.dev/tree/main/',
// Useful options to enforce blogging best practices
onInlineTags: 'warn',
onInlineAuthors: 'warn',
onUntruncatedBlogPosts: 'warn',
},
theme: {
customCss: './src/css/custom.css',
},
pages: {},
sitemap: {},
svgr: {},
} satisfies Preset.Options,
],
],
themeConfig: {
image: 'img/social-card.jpg',
colorMode: {
respectPrefersColorScheme: true,
},
announcementBar: {
id: 'announcement',
content:
'🚀 <b>New Release:</b> <a href="/blog/v0.8.0-release">Group components with namespaces and paths in CGP v0.8.0</a> 🚀',
// The bar's colours follow the theme through the tokens in src/css/custom.css.
backgroundColor: 'var(--cgp-announce-bg)',
textColor: 'var(--cgp-announce-text)',
isCloseable: true,
},
navbar: {
title: 'Context-Generic Programming',
logo: {
alt: 'Context-Generic Programming Logo',
src: 'img/cgp-logo.svg',
// The logo's red reaches only about 2:1 on the dark navbar, so the dark theme shows a lighter
// tint.
srcDark: 'img/cgp-logo-dark.svg',
},
items: [
{to: '/docs/tutorials/hello', label: 'Tutorials', position: 'left'},
{to: '/docs', label: 'Docs', position: 'left'},
{to: '/blog', label: 'Blog', position: 'left'},
{to: '/docs/ai/skills/', label: 'AI', position: 'left'},
{
href: 'https://github.com/contextgeneric/cgp',
label: 'GitHub',
position: 'right',
},
],
},
footer: {
style: 'dark',
links: [
{
title: 'Docs',
items: [
{
label: 'Introduction',
to: '/docs',
},
{
label: 'Quickstart',
to: '/docs/quickstart',
},
{
label: 'Overview',
to: '/docs/overview',
},
{
label: 'Tutorials',
to: '/docs/category/tutorials',
},
],
},
{
title: 'Community',
items: [
{
label: 'GitHub Discussions',
href: 'https://github.com/orgs/contextgeneric/discussions',
},
{
label: 'Discord',
href: 'https://discord.gg/Hgk3rCw6pQ',
},
{
label: 'Reddit',
href: 'https://www.reddit.com/r/cgp/',
},
{
label: 'Bluesky',
href: 'https://bsky.app/profile/contextgeneric.dev',
},
],
},
{
title: 'More',
items: [
{
label: 'Blog',
to: '/blog',
},
{
label: 'GitHub',
href: 'https://github.com/contextgeneric/cgp',
},
],
},
],
copyright: `Licensed by <a href="https://maybevoid.com">MaybeVoid</a> under a <a href="https://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International License</a>.`,
},
prism: {
theme: prismLight,
darkTheme: prismDark,
// Prism's default bundle lacks these, so their fenced blocks would render as plain text. The
// grammars ship in the `prismjs` package Docusaurus already installs. Scala extends Java's
// grammar, so Java comes first.
additionalLanguages: ['toml', 'bash', 'ebnf', 'haskell', 'ocaml', 'java', 'scala'],
},
} satisfies Preset.ThemeConfig,
};
export default config;