-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathastro.config.mjs
71 lines (65 loc) · 2.36 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
import fsExtra from 'fs-extra'
import { defineConfig } from 'astro/config'
import tailwind from '@astrojs/tailwind'
import rehypePrettyCode from 'rehype-pretty-code'
// import { transformerCopyButton } from '@rehype-pretty/transformers'
import rehypePlugins from './lib/rehype/plugins.ts'
import remarkPlugins from './lib/remark/plugins.ts'
import netlify from '@astrojs/netlify'
import node from '@astrojs/node'
// The netlify adapter doesn't support preview mode, so we use the node adapter locally by default for "npm run preview"
let adapter = process.argv.includes('--node') ? node({ mode: 'standalone' }) : netlify()
// See: https://github.com/atomiks/rehype-pretty-code/blob/master/website/assets/moonlight-ii.json
const moonlightV2 = await fsExtra.readJson('./lib/rehype/themes/moonlight-ii.json')
// see: https://astro.build/config
export default defineConfig({
adapter,
devToolbar: {
enabled: false,
},
integrations: [
tailwind({
// Disable injecting a basic `base.css` import on every page so I can define and import my own
applyBaseStyles: false,
}),
],
markdown: {
remarkPlugins,
rehypePlugins: [
...rehypePlugins,
[
// Include this when building for the site, but not for the RSS feed (which leads to errors)
rehypePrettyCode,
{
// see: https://rehype-pretty.pages.dev/#options
keepBackground: false,
theme: moonlightV2,
tokensMap: {
fn: 'entity.name.function',
kw: 'keyword',
key: 'meta.object-literal.key',
pm: 'variable.parameter',
obj: 'variable.other.object',
str: 'string',
},
// FIXME: scrolls horizontally with the code instead of staying in the top right corner
// transformers: [
// transformerCopyButton({
// visibility: 'hover',
// feedbackDuration: 2500,
// }),
// ],
},
],
],
syntaxHighlight: false, // use rehype-pretty-code instead of built-in shiki/prism
},
scopedStyleStrategy: 'class',
site: 'https://michaeluloth.com',
trailingSlash: 'always',
vite: {
// solves "Error: No loader is configured for ".node" files: node_modules/fsevents/fsevents.node"
// see: https://stackoverflow.com/a/75655669/8802485
optimizeDeps: { exclude: ['fsevents'] },
},
})