-
Notifications
You must be signed in to change notification settings - Fork 0
/
astro.config.ts
171 lines (170 loc) · 4.4 KB
/
astro.config.ts
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
import cloudflare from '@astrojs/cloudflare';
import mdx from '@astrojs/mdx';
import sitemap from '@astrojs/sitemap';
import solidJs from '@astrojs/solid-js';
import tailwind from '@astrojs/tailwind';
import compress from 'astro-compress';
import { defineConfig, passthroughImageService } from 'astro/config';
import { h } from 'hastscript';
import rehypeAutolinkHeadings, {
type Options as RehypeAutoLinkHeadingsOptions,
} from 'rehype-autolink-headings';
import rehypeKatex from 'rehype-katex';
import rehypePrettyCode, {
type Options as RehypePrettyCodeOptions,
} from 'rehype-pretty-code';
import rehypeSlug from 'rehype-slug';
import remarkCard, { type Config as RemarkCardConfig } from 'remark-card';
import remarkDirective from 'remark-directive';
import remarkGfm from 'remark-gfm';
import remarkMath from 'remark-math';
import remarkVideo, { type Config as RemarkVideoConfig } from 'remark-video';
import { iconNameTypes } from './src/lib/astro-integrations/icon-name-type';
import { pagefind } from './src/lib/astro-integrations/pagefind';
import { SITE_URL, VIDEO_FALLBACK_MESSAGE } from './src/lib/consts';
import rehypePagefindIgnore from './src/lib/unified/plugins/rehype-pagefind-ignore';
import remarkAstroImageAssets from './src/lib/unified/plugins/remark-astro-image-assets';
import remarkCallout from './src/lib/unified/plugins/remark-callout';
import remarkEmbed, {
type RemarkEmbedOptions,
} from './src/lib/unified/plugins/remark-embed';
import remarkFootnote from './src/lib/unified/plugins/remark-footnote';
import remarkLineBreaks from './src/lib/unified/plugins/remark-line-breaks';
import remarkLinkCard from './src/lib/unified/plugins/remark-link-card';
import {
canvaTransformer,
googleSlidesTransformer,
oEmbedTransformer,
youTubeTransformer,
} from './src/lib/unified/transformers';
// https://astro.build/config
export default defineConfig({
site: SITE_URL,
output: 'hybrid',
adapter: cloudflare({
platformProxy: {
enabled: true,
persist: true,
},
}),
image: {
service: passthroughImageService(),
},
integrations: [
mdx(),
tailwind({
applyBaseStyles: false,
}),
solidJs(),
sitemap(),
iconNameTypes(),
pagefind(),
compress({
CSS: true,
HTML: false,
Image: false,
JavaScript: true,
SVG: false,
Logger: 1,
}),
],
prefetch: {
defaultStrategy: 'viewport',
prefetchAll: true,
},
trailingSlash: "always",
i18n: {
defaultLocale: 'en',
locales: ['en', 'ja'],
},
vite: {
css: {
devSourcemap: true,
transformer: 'postcss',
},
server: {
watch: {
usePolling: true,
interval: 1000,
},
},
ssr: {
external: ['node:fs', 'unfurl.js'],
},
},
markdown: {
syntaxHighlight: false,
smartypants: false,
remarkRehype: {
footnoteLabel: ' ',
footnoteLabelProperties: { className: [''] },
footnoteLabelTagName: 'hr',
},
remarkPlugins: [
remarkMath,
remarkGfm,
remarkDirective,
remarkAstroImageAssets,
remarkCallout,
[
remarkCard,
{
customHTMLTags: {
enabled: true,
},
cardGridClass: 'card-grid',
cardClass: 'card',
} satisfies RemarkCardConfig,
],
[
remarkVideo,
{
videoContainerTag: 'figure',
fallbackContent: h('p.fallback-content', VIDEO_FALLBACK_MESSAGE),
} satisfies RemarkVideoConfig,
],
remarkFootnote,
[
remarkEmbed,
{
transformers: [
canvaTransformer,
googleSlidesTransformer,
youTubeTransformer,
oEmbedTransformer,
],
} satisfies RemarkEmbedOptions,
],
remarkLinkCard,
remarkLineBreaks,
],
rehypePlugins: [
rehypeKatex,
rehypeSlug,
[
rehypeAutolinkHeadings,
{
behavior: 'prepend',
content: h(
'span.heading-anchor-icon',
{
title: 'Anchor link',
},
['#'],
),
} satisfies RehypeAutoLinkHeadingsOptions,
],
[
rehypePrettyCode,
{
theme: {
light: 'catppuccin-latte',
dark: 'github-dark',
},
grid: false,
} satisfies RehypePrettyCodeOptions,
],
rehypePagefindIgnore,
],
},
});