-
Notifications
You must be signed in to change notification settings - Fork 4
/
docusaurus.config.js
128 lines (115 loc) · 2.97 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
// @ts-check
// `@type` JSDoc annotations allow editor autocompletion and type checking
// (when paired with `@ts-check`).
// There are various equivalent ways to declare your Docusaurus config.
// See: https://docusaurus.io/docs/api/docusaurus-config
import remarkMath from "remark-math";
import rehypeKatex from "rehype-katex";
import typstRender from "./src/remark/typst.ts";
import TypstTheme from "./src/theme/typst.ts";
const config = {
title: "CeTZ Documentation",
url: "https://cetz-package.github.io/",
baseUrl: "/docs/",
organizationName: "cetz-package",
projectName: "docs",
onBrokenLinks: "throw",
onBrokenMarkdownLinks: "warn",
i18n: {
defaultLocale: "en",
locales: ["en"],
},
plugins: ["@orama/plugin-docusaurus-v3"],
presets: [
[
"classic",
{
docs: {
path: "cetz/docs",
routeBasePath: "/",
sidebarPath: "./sidebars.js",
editUrl: "https://github.com/cetz-package/docs/blob/main",
beforeDefaultRemarkPlugins: [typstRender],
remarkPlugins: [remarkMath],
rehypePlugins: [rehypeKatex],
},
// blog: false,
theme: {
customCss: [
"./src/css/custom.css",
"./src/css/parameter.css",
"./src/css/type.css",
"./src/css/code.css",
"./src/css/function.css",
],
},
},
],
],
themeConfig: {
colorMode: {
respectPrefersColorScheme: true,
},
docs: {
sidebar: {
hideable: true,
},
},
navbar: {
title: "CeTZ Documentation",
items: [
{
type: "docSidebar",
sidebarId: "docs",
label: "Docs",
},
{
type: "docSidebar",
sidebarId: "api",
label: "API",
},
],
},
footer: {
links: [
{
label: "Homepage",
href: "https://cetz-package.github.io",
},
{
label: "Github",
href: "https://github.com/cetz-package/cetz",
},
],
},
prism: {
theme: TypstTheme,
},
},
stylesheets: [
{
href: "https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css",
type: "text/css",
integrity:
"sha384-odtC+0UGzzFL/6PNoE8rX/SPcQDXBJ+uRepguP4QkPCm2LBxH3FA3y+fKSiJ+AmM",
crossorigin: "anonymous",
},
],
markdown: {
preprocessor: ({ filePath, fileContent }) => {
return fileContent.replaceAll(
/\{\{(\w+)\}\}/g,
(_, type) => `<Type>${type}</Type>`,
);
// .replaceAll(/@@generated\/([\w-\/]+)/g, (_, path) => {
// const split = path.split("/");
// // console.log(split, split[split.length - 1]);
// const output = `## ${split[split.length - 1]}\nimport Imported from "@site/cetz/docs/_generated/${path}.mdx";\n<Imported />
// `;
// // console.log(output);
// return output;
// });
},
},
};
export default config;