-
Notifications
You must be signed in to change notification settings - Fork 0
/
astro.config.mjs
66 lines (63 loc) · 2.19 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
import { defineConfig } from 'astro/config'
import fsExtra from 'fs-extra'
import rehypePrettyCode from 'rehype-pretty-code'
import remarkUnwrapImages from 'remark-unwrap-images'
import remarkWikiLink from '@portaljs/remark-wiki-link'
import tailwind from '@astrojs/tailwind'
import remarkRemoveTags from './lib/remark/remove-tags.ts'
import rehypeCloudinaryImageAttributes from './lib/rehype/cloudinary-image-attributes.ts'
// source: 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({
compressHTML: true,
integrations: [
tailwind({
// Disable injecting a basic `base.css` import on every page so I can define and import my own
applyBaseStyles: false,
}),
],
markdown: {
remarkPlugins: [
remarkRemoveTags,
remarkUnwrapImages,
[
remarkWikiLink,
{
// see: https://github.com/datopian/portaljs/tree/main/packages/remark-wiki-link
// see: https://stackoverflow.com/a/76897910/8802485
pathFormat: 'obsidian-absolute',
wikiLinkResolver: slug => [`${slug}/`], // expects all pages to have root-level paths
},
],
],
rehypePlugins: [
rehypeCloudinaryImageAttributes,
[
rehypePrettyCode,
{
// see: https://rehype-pretty-code.netlify.app
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',
},
},
],
],
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'] },
},
})