-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
docusaurus.config.js
208 lines (193 loc) · 5.76 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
import { unified } from 'unified'
import remarkParse from 'remark-parse'
import remarkRehype from 'remark-rehype';
import rehypeStringify from 'rehype-stringify';
const { themes } = require('prism-react-renderer');
const VUKORY_SVG = '<svg xmlns="http://www.w3.org/2000/svg" height="1em" viewBox="0 0 378.627 333.846"><path fill="currentcolor" d="M86.059 0 67.28 69.362l27.025 28.86-70.296 40.574 20.506 7.41L0 175.596h70.96l-2.327 13.242 67.302.058-12.653 46.196 18.083-3.42 27.746 96.978 20.202 5.196 20.203-5.196 27.745-96.977 18.083 3.419-12.653-46.196 67.302-.058-2.326-13.241h70.96l-44.515-29.391 20.505-7.41-70.296-40.573 27.026-28.861L292.567 0l-56.345 57.422-46.909 21.009-46.909-21.01Z"/></svg>';
/**
* @typedef {import("@docusaurus/types").Config} Config
*/
/**
* Config for Docusaurus.
*
* $.tagline is undefined, as our copy is specified in the code instead.
* $.themeConfig.navbar.logo is undefined as this is configured with a custom component.
* $.themeConfig.footer.style is ignored as this is overridden with custom CSS.
*
* @type {Config}
*/
const config = {
title: 'SVGO',
favicon: 'img/favicon.ico',
url: 'https://svgo.dev',
baseUrl: '/',
baseUrlIssueBanner: false,
organizationName: 'svg',
projectName: 'svgo.dev',
trailingSlash: true,
onBrokenLinks: 'throw',
onBrokenMarkdownLinks: 'throw',
i18n: {
defaultLocale: 'en',
locales: [
'en'
],
},
markdown: {
parseFrontMatter: async (params) => {
const result = await params.defaultParseFrontMatter(params);
if (!result.frontMatter.svgo?.parameters) {
return result;
}
for (const key in result.frontMatter.svgo.parameters) {
const param = result.frontMatter.svgo.parameters[key];
if (!param || !param.description) {
continue;
}
let processed = await unified()
.use(remarkParse, { allowDangerousHtml: true })
.use(remarkRehype, { allowDangerousHtml: true })
.use(rehypeStringify, {
allowDangerousCharacters: true,
allowDangerousHtml: true,
})
.process(param.description);
param.description = processed.value;
}
return result;
},
mdx1Compat: {
admonitions: false,
comments: false,
headingIds: false
}
},
plugins: [
[
'@docusaurus/theme-classic',
{
customCss: require.resolve('./src/css/custom.css'),
},
],
[
'@docusaurus/plugin-content-pages',
{
path: 'src/pages',
routeBasePath: '/'
}
],
[
'@docusaurus/plugin-content-docs',
{
path: '.svgo/docs',
breadcrumbs: true,
sidebarPath: require.resolve('./sidebars.js'),
editUrl: ({ docPath }) => `https://github.com/svg/svgo/tree/main/docs/${docPath}`,
}
],
[
'@docusaurus/plugin-sitemap',
{
filename: 'sitemap.xml',
ignorePatterns: [
'/.well-known/**'
],
createSitemapItems: async (params) => {
const { defaultCreateSitemapItems, ...rest } = params;
/** @type {object[]} */
let items = await defaultCreateSitemapItems(rest);
items = items.map((item) => {
const pathname = new URL(item.url).pathname;
if (pathname === '/') {
item.priority = 1;
} else if (pathname === '/search/') {
item.priority = 0.1;
item.changefreq = 'monthly';
}
return item;
});
return items;
},
}
],
'./src/plugins/prefers-color-scheme.js',
'./src/plugins/configure-svgo.js'
],
themes: [
'@docusaurus/theme-live-codeblock',
[
require.resolve('@easyops-cn/docusaurus-search-local'),
{
indexDocs: true,
indexBlog: false,
language: 'en',
hashed: true,
searchBarPosition: 'right'
}
]
],
themeConfig: {
colorMode: {
disableSwitch: true,
respectPrefersColorScheme: true,
},
navbar: {
items: [
{
type: 'docSidebar',
position: 'left',
sidebarId: 'docsSidebar',
label: 'Documentation'
},
{
href: 'https://jakearchibald.github.io/svgomg/',
position: 'left',
label: 'Playground'
},
{
href: 'https://github.com/svg/svgo',
position: 'right',
html: '<img src="https://img.shields.io/github/stars/svg/svgo?style=social" alt="" height="20" width="88"/>',
className: 'github-shield',
'aria-label': 'GitHub repository'
}
],
},
prism: {
theme: themes.vsLight,
darkTheme: themes.oneDark
},
footer: {
links: [
{
title: 'Community',
items: [
{
label: 'Stack Overflow',
href: 'https://stackoverflow.com/questions/tagged/svgo',
},
{
label: 'Discord',
href: 'https://discord.com/invite/z8jX8NYxrE',
}
],
},
{
title: 'More',
items: [
{
label: 'GitHub',
href: 'https://github.com/svg/svgo',
},
{
label: 'Open Collective',
href: 'https://opencollective.com/svgo'
}
]
}
],
copyright: `Copyright © ${new Date().getFullYear()} <a href="https://github.com/svg/svgo/graphs/contributors">SVGO and Contributors</a><br>Source Code under MIT · Content and Assets under CC-BY-4.0<br>Designed and Illustrated by <a class="designer-attribution" href="https://www.artstation.com/vukory" target="_blank">Vukory ${VUKORY_SVG}</a>`
},
},
};
export default config;