-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathastro.config.mjs
70 lines (66 loc) · 2.18 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
import { defineConfig } from 'astro/config';
import mdx from '@astrojs/mdx';
import sitemap from '@astrojs/sitemap';
import tailwind from "@astrojs/tailwind";
import rehypePrettyCode from 'rehype-pretty-code';
import { visit } from 'unist-util-visit';
import solidJs from "@astrojs/solid-js";
import remarkMath from "remark-math"
import rehypeKatex from "rehype-katex"
import path from "path"
// https://flaviocopes.com/fix-dirname-not-defined-es-module-scope/
import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
// https://astro.build/config
export default defineConfig({
site: 'https://blog.yujinyan.me',
integrations: [mdx(), sitemap(), tailwind(), solidJs()],
vite: {
resolve: {
alias: {
"@": path.resolve(__dirname, "./src")
}
}
},
markdown: {
extendDefaultPlugins: true,
syntaxHighlight: false,
remarkPlugins: [remarkMath],
rehypePlugins: [rehypeKatex, [rehypePrettyCode, {
// theme: "solarized-dark",
// theme: "material-theme-palenight",
theme: "one-dark-pro",
onVisitLine(node) {
visit(node, n => n.type === "text", n => {
if (n.value.replace(/\s/g, '') === '//highlight-line') {
n.value = '';
if (!node.properties) {
node.properties = {};
}
if (!node.properties['className']) {
node.properties['className'] = [];
}
node.properties['className'].push("highlighted-line");
}
});
},
onVisitHighlightedLine(node) {
node.properties.className.push("highlighted-line");
}
}]]
}
// markdown: {
// shikiConfig: {
// // Choose from Shiki's built-in themes (or add your own)
// // https://github.com/shikijs/shiki/blob/main/docs/themes.md
// theme: 'material-theme-palenight',
// // Add custom languages
// // Note: Shiki has countless langs built-in, including .astro!
// // https://github.com/shikijs/shiki/blob/main/docs/languages.md
// langs: [],
// // Enable word wrap to prevent horizontal scrolling
// // wrap: true,
// },
// },
});