-
Notifications
You must be signed in to change notification settings - Fork 4
/
astro.config.mjs
110 lines (107 loc) · 2.65 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
102
103
104
105
106
107
108
109
110
import { defineConfig } from "astro/config";
import mdx from "@astrojs/mdx";
import sitemap from "@astrojs/sitemap";
import tailwind from "@astrojs/tailwind";
import robotsTxt from "astro-robots-txt";
import pagefind from "./pagefind.mjs";
import svelte from "@astrojs/svelte";
import prefetch from "@astrojs/prefetch";
import astroExpressiveCode, { loadShikiTheme } from "astro-expressive-code";
import remarkObsidianCallout from "remark-obsidian-callout";
import { resolve } from "node:path";
import rehypeAutolinkHeadings from "rehype-autolink-headings";
import rehypeSlug from "rehype-slug";
import rehypeExternalLinks from "rehype-external-links";
const prod = process.env.NODE_ENV === "production";
const theme = await loadShikiTheme("material-theme-darker");
theme.styleOverrides.frames = {
editorBackground: "transparent",
codeBackground: "transparent",
terminalBackground: "transparent",
terminalTitlebarBackground: "transparent",
terminalTitlebarBorderBottom: "transparent",
editorTabBarBackground: "transparent",
editorActiveTabBackground: "transparent",
editorActiveTabBorderBottom: "transparent",
shadowColor: "transparent",
};
// https://astro.build/config
export default defineConfig({
site: "https://labs.leaningtech.com",
integrations: [
astroExpressiveCode({
theme,
styleOverrides: {
codeBackground: "transparent",
borderColor: "rgb(41, 37, 36)", // border-stone-800
// doesn't work?
frames: {},
},
}),
mdx(),
sitemap(),
tailwind(),
robotsTxt(),
pagefind(),
svelte(),
prefetch({
// Prefetch hovered internal links
intentSelector: ["a[href^='/']"],
}),
],
markdown: {
remarkPlugins: [[remarkObsidianCallout, {}]],
rehypePlugins: [
rehypeSlug, // astro does this automatically but rehype-autolink-headings needs it
[
rehypeAutolinkHeadings,
{
behavior: "append",
content: {
type: "element",
tagName: "img",
properties: {
className:
"not-prose inline-block align-middle heading-link-icon",
style: "margin-left: 8px",
src: "/icons/heading-link.svg",
},
children: [],
},
},
],
[
rehypeExternalLinks,
{
content: {
type: "element",
tagName: "img",
properties: {
className: "not-prose inline-block align-middle",
style: "margin-left: 2px",
src: "/icons/external-link.svg",
},
children: [],
},
target: "_blank",
},
],
],
},
compressHTML: prod,
build: {
format: "file",
inlineStylesheets: "always",
},
trailingSlash: "never",
vite: {
resolve: {
alias: [
{
find: "@",
replacement: resolve("./src/"),
},
],
},
},
});