-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathastro.config.mjs
101 lines (96 loc) · 2.16 KB
/
astro.config.mjs
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
import { defineConfig } from "astro/config";
import emoji from "remark-emoji";
import remarkFootnotes from "remark-footnotes";
import remarkMath from "remark-math";
import remarkLinkCard from "remark-link-card";
import rehypeAutolinkHeadings from "rehype-autolink-headings";
import rehypeSlug from "rehype-slug";
import rehypeKatex from "rehype-katex";
import { s } from "hastscript";
import tailwind from "@astrojs/tailwind";
import rehypePrismPlus from "rehype-prism-plus";
import partytown from "@astrojs/partytown";
import sitemap from "@astrojs/sitemap";
import remarkCodeTitles from "./src/lib/utils/remark-plugins/remark-code-titles";
import generateOgImage from "./src/integrations/generateOgImages";
let site = "http://localhost:3000";
if (process.env.CF_PAGES_BRANCH === "main") {
site = "https://egashira.dev";
} else if (process.env.CF_PAGES_URL) {
site = process.env.CF_PAGES_URL;
}
const anchorIcon = s(
"svg",
{
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24",
fill: "none",
stroke: "currentColor",
strokeWidth: "2",
class: "anchor-icon"
},
[
s("path", {
stroke: "none",
fill: "none",
d: "M0 0h24v24H0z"
}),
s("path", {
d: "M10 14a3.5 3.5 0 0 0 5 0l4 -4a3.5 3.5 0 0 0 -5 -5l-.5 .5"
}),
s("path", {
d: "M14 10a3.5 3.5 0 0 0 -5 0l-4 4a3.5 3.5 0 0 0 5 5l.5 -.5"
})
]
);
const partytownConfig = {
config: { forward: ["dataLayer.push"] }
};
export default defineConfig({
integrations: [
tailwind(),
sitemap(),
partytown(partytownConfig),
generateOgImage()
],
markdown: {
syntaxHighlight: "prism",
remarkPlugins: [
emoji,
remarkMath,
[
remarkFootnotes,
{
inlineNotes: true
}
],
remarkCodeTitles,
[
remarkLinkCard,
{
shortenUrl: true
}
]
],
rehypePlugins: [
rehypeSlug,
[
rehypeAutolinkHeadings,
{
content: anchorIcon
}
],
rehypeKatex,
[
rehypePrismPlus,
{
ignoreMissing: true
}
]
]
},
site,
build: {
format: "file"
}
});