-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathastro.config.mts
More file actions
97 lines (96 loc) · 2.66 KB
/
astro.config.mts
File metadata and controls
97 lines (96 loc) · 2.66 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
import { defineConfig } from "astro/config";
import mdx from "@astrojs/mdx";
import react from "@astrojs/react";
import { rehypeCustomEmoji, ownLineFootnote } from "./src/utils/mdx-utils.ts";
import rehypeAutolinkHeadings from "rehype-autolink-headings";
import rehypeSlug from "rehype-slug";
import rehypeToc from "rehype-toc";
import vercel from "@astrojs/vercel";
import expressiveCode from "astro-expressive-code";
import metaTags from "astro-meta-tags";
import remarkAltTextFiles from "@fujocoded/remark-alt-text-files";
import icon from "astro-icon";
import type { Element, Parents } from "hast";
// https://astro.build/config
export default defineConfig({
// ...
integrations: [
expressiveCode({
themes: ["dracula-soft"],
}),
mdx(),
react(),
metaTags(),
icon(),
],
markdown: {
remarkPlugins: [remarkAltTextFiles],
rehypePlugins: [
ownLineFootnote,
rehypeSlug,
[
rehypeAutolinkHeadings,
{
behavior: "wrap",
},
],
// @ts-expect-error - TODO: fix this
[
rehypeToc,
{
customizeTOC: (toc: Element) => {
if ((toc.children[0] as Parents).children?.length > 0) {
return toc;
}
return false;
},
customizeTOCItem: (toc: Element, heading: Element) => {
const headingContent = heading.children?.[0] as Element;
if (headingContent.children.length > 1) {
(toc.children[0] as Element).children =
headingContent.children.filter(
(node) => node.type !== "element" || node.tagName !== "sup"
);
}
return toc;
},
},
],
[
rehypeCustomEmoji,
{
emojis: {
bobaparty: "/emojis/bobaparty.png",
bobatwt: "/emojis/bobatwt.png",
bobaeyes: "/emojis/bobaeyes.png",
},
className: "custom-emoji",
},
],
],
},
redirects: {
// TODO: Reactivate these and delete the pages when
// the vercel adapter bug is fixed
"/subscribe": {
destination: "https://patreon.com/fujocoded",
status: 307,
},
"/support-me": {
destination: "https://patreon.com/fujocoded",
status: 307,
},
"/hire-me": {
destination: "/resume",
status: 307,
},
"/working-together": {
destination:
"https://docs.google.com/presentation/d/1p60oTpYtqVx8rtmR6naZvcWAo-PjELp1CMHFkrRAXMo/edit?slide=id.g36a4013e27d_0_576",
status: 307,
},
},
output: "server",
adapter: vercel(),
site: "https://www.essentialrandomness.com/",
});