-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathastro.config.mjs
More file actions
executable file
·97 lines (94 loc) · 2.47 KB
/
astro.config.mjs
File metadata and controls
executable file
·97 lines (94 loc) · 2.47 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
// @ts-check
import starlight from "@astrojs/starlight";
import { pluginLineNumbers } from "@expressive-code/plugin-line-numbers";
import { defineConfig } from "astro/config";
import addClasses from "rehype-class-names";
import rehypeGraphviz from "rehype-graphviz";
import rehypeKatex from "rehype-katex";
import remarkMath from "remark-math";
import {
astroLatexCompile,
rehypeValidateLinks,
starlightDomPatches,
starlightIndexOnlySidebar,
syncDocsToPublic,
} from "./src";
// Common Config Items
const SITE_NAME = "My Grand Amazing Site";
const STARLIGHT_SIDEBAR_CONFIG = starlightIndexOnlySidebar({
maxDepthNesting: 1,
dirnameDeterminesLabels: false,
directories: [
"reference",
"csci-323-algorithms",
"csci-340-operating-systems",
"csci-328-algorithms-for-big-data",
],
});
// https://astro.build/config
export default defineConfig({
markdown: {
remarkPlugins: [
remarkMath, // adds support for math
],
rehypePlugins: [
rehypeKatex, // co-dependent with remark-math
[
addClasses,
{ ".katex": "not-content", "mjx-container>svg": "not-content" },
],
rehypeGraphviz, // Graphviz diagram support
rehypeValidateLinks, // validate links and convert to absolute paths
],
},
integrations: [
astroLatexCompile({
svgOutputDir: "public/static/tex-svgs",
removeOrphanedSvgs: true,
}),
syncDocsToPublic({
preserveDirs: ["static"],
exposePageSrcButton: true,
}),
starlightDomPatches({
hideSingleLineGutters: true,
wrapDetailsContent: true,
syncTocLabelsFromHeadings: true,
}),
// astroNormalizePaths(),
starlight({
title: SITE_NAME,
tableOfContents: {
minHeadingLevel: 2, // h1 not included since it conflicts with frontmatter title
maxHeadingLevel: 6, // include up to h6 in table of contents
},
plugins: [STARLIGHT_SIDEBAR_CONFIG],
customCss: ["/src/styles/main.scss", "katex/dist/katex.min.css"],
expressiveCode: {
plugins: [pluginLineNumbers()],
defaultProps: {
showLineNumbers: true,
overridesByLang: {
text: {
showLineNumbers: false,
},
},
},
},
head: [
{
tag: "script",
attrs: {
type: "module",
src: "/static/js/index.js",
},
},
],
}),
],
vite: {
ssr: {
noExternal: ["katex"],
},
},
});