-
Notifications
You must be signed in to change notification settings - Fork 0
/
astro.config.mjs
45 lines (42 loc) · 1.31 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
import mdx from "@astrojs/mdx";
import prefetch from "@astrojs/prefetch";
import sitemap from "@astrojs/sitemap";
import tailwind from "@astrojs/tailwind";
import { defineConfig } from "astro/config";
import rehypePrettyCode from "rehype-pretty-code";
import { remarkReadingTime } from "./plugins/remark-reading-time.mjs";
/** @type {import('rehype-pretty-code').Options} */
const options = {
theme: {
dark: "github-dark",
light: "min-light",
},
keepBackground: false,
onVisitLine(node) {
// Prevent lines from collapsing in `display: grid` mode, and
// allow empty lines to be copy/pasted
if (node.children.length === 0) {
node.children = [{ type: "text", value: " " }];
}
},
onVisitHighlightedLine(node) {
if (!node.properties.className) {
node.properties.className = [];
}
node.properties.className.push("highlighted");
},
onVisitHighlightedWord(node) {
node.properties.className = ["word"];
},
};
// https://astro.build/config
export default defineConfig({
site: "https://www.davidhu.io",
integrations: [mdx(), sitemap(), tailwind(), prefetch()],
markdown: {
syntaxHighlight: false,
// TODO: this plugin does not work for mdx files, need to figure out why
rehypePlugins: [[rehypePrettyCode, options]],
remarkPlugins: [remarkReadingTime],
},
});