/
astro.config.mjs
68 lines (67 loc) · 1.97 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
import { defineConfig } from 'astro/config'
import tailwind from '@astrojs/tailwind'
import partytown from '@astrojs/partytown'
import sitemap from '@astrojs/sitemap'
import solid from '@astrojs/solid-js'
import react from '@astrojs/react'
import { h } from 'hastscript'
import { toString } from 'hast-util-to-string'
import { fileURLToPath } from 'url'
import remarkCalcReadingMin from './src/plugins/remarkCalcReadingMin.mjs'
import nodejs from '@astrojs/node'
import vercel from '@astrojs/vercel/serverless'
const root = fileURLToPath(new URL('.', import.meta.url))
const isDev = process.env.DEV
const site =
process.env.VERCEL_ENV === 'preview'
? `https://${process.env.PUBLIC_VERCEL_URL}`
: process.env.SITE ?? 'http://localhost:3000'
console.log('site env', {
PUBLIC_VERCEL_URL: process.env.PUBLIC_VERCEL_URL,
VERCEL_ENV: process.env.VERCEL_ENV,
SITE: process.env.SITE,
})
console.log('site', site)
// https://astro.build/config
export default defineConfig({
output: 'server',
adapter: vercel(),
integrations: [sitemap(), react()],
site,
markdown: {
syntaxHighlight: false,
remarkPlugins: [
remarkCalcReadingMin,
'remark-gfm',
['remark-directive', {}],
['remark-directive-rehype', {}],
'remark-smartypants',
[
'remark-prism',
{
plugins: ['diff-highlight', 'line-numbers'],
},
],
],
rehypePlugins: [
// Add a Rehype plugin that you want to enable for your project.
// If you need to provide options for the plugin, you can use an array and put the options as the second item.
'rehype-slug',
[
'rehype-autolink-headings',
{
behavior: 'prepend',
content(node) {
return [h(null, '#')]
},
properties: {
ariaHidden: true,
tabIndex: -1,
},
},
],
[`${root}/src/plugins/imageTrans.mjs`, {}],
[`${root}/src/plugins/tableWrapper.mjs`, {}],
],
},
})