-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathastro.config.mjs
More file actions
106 lines (99 loc) · 3.47 KB
/
astro.config.mjs
File metadata and controls
106 lines (99 loc) · 3.47 KB
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
// @ts-check
import { defineConfig } from 'astro/config';
import sitemap from '@astrojs/sitemap';
import path from 'node:path';
import tailwindcss from '@tailwindcss/vite';
import mdx from '@astrojs/mdx';
import react from '@astrojs/react';
import remarkDirective from 'remark-directive';
import rehypeSlug from 'rehype-slug';
import { highlightLinesTransformer } from './src/plugins/shiki-highlight-transformer.mjs';
import { remarkAside } from './src/plugins/remark-aside.mjs';
import { remarkTransformRequire } from './src/plugins/remark-transform-require.mjs';
import { remarkTransformDetails } from './src/plugins/remark-transform-details.mjs';
import { remarkHeadingId } from './src/plugins/remark-heading-id.mjs';
import { remarkTransformLinks } from './src/plugins/remark-transform-links.mjs';
import { remarkStripImports } from './src/plugins/remark-strip-imports.mjs';
import { remarkStripHighlightComments } from './src/plugins/remark-strip-highlight-comments.mjs';
// https://astro.build/config
export default defineConfig({
site: 'https://adapty.io',
base: '/docs',
outDir: './build',
build: {
inlineStylesheets: 'never',
},
vite: {
plugins: [tailwindcss()],
define: {
global: 'window',
'process.env': '{}',
},
resolve: {
alias: {
'@site': path.resolve('./'),
'@components': path.resolve('./src/components'),
'react-medium-image-zoom/dist/styles.css': path.resolve('./src/styles/empty.css'),
'react-medium-image-zoom': path.resolve('./src/components/ZoomShim.tsx'),
}
}
},
markdown: {
remarkPlugins: [remarkHeadingId, remarkDirective, remarkAside, remarkStripImports, remarkStripHighlightComments, remarkTransformRequire, remarkTransformDetails, remarkTransformLinks],
rehypePlugins: [rehypeSlug],
shikiConfig: {
theme: 'github-light',
wrap: true,
transformers: [
{
name: 'title-transformer',
pre(node) {
// Extract title from meta
const meta = this.options.meta?.__raw || '';
const titleMatch = meta.match(/title="([^"]+)"/);
if (titleMatch) {
node.properties['data-title'] = titleMatch[1];
}
// Add language attribute for badge display
const lang = this.options.lang || '';
if (lang) {
node.properties['data-language'] = lang;
}
}
},
highlightLinesTransformer()
]
},
},
integrations: [
react(),
sitemap(),
mdx({
remarkPlugins: [remarkHeadingId, remarkDirective, remarkAside, remarkStripImports, remarkStripHighlightComments, remarkTransformRequire, remarkTransformDetails, remarkTransformLinks],
rehypePlugins: [rehypeSlug],
shikiConfig: {
theme: 'github-light',
wrap: true,
transformers: [
{
name: 'title-transformer',
pre(node) {
// Extract title from meta
const meta = this.options.meta?.__raw || '';
const titleMatch = meta.match(/title="([^"]+)"/);
if (titleMatch) {
node.properties['data-title'] = titleMatch[1];
}
// Add language attribute for badge display
const lang = this.options.lang || '';
if (lang) {
node.properties['data-language'] = lang;
}
}
},
highlightLinesTransformer()
]
}
})
]
});