-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
astro.config.ts
99 lines (94 loc) · 3.15 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
import starlight from '@astrojs/starlight';
import { pluginCollapsibleSections } from '@expressive-code/plugin-collapsible-sections';
import { defineConfig, sharpImageService } from 'astro/config';
import { makeLocalesConfig } from './config/locales';
import { makeSidebar } from './config/sidebar';
import rehypeSlug from 'rehype-slug';
import remarkSmartypants from 'remark-smartypants';
import { sitemap } from './integrations/sitemap';
import { rehypeAutolink } from './plugins/rehype-autolink';
import { rehypeTasklistEnhancer } from './plugins/rehype-tasklist-enhancer';
import { remarkFallbackLang } from './plugins/remark-fallback-lang';
/* https://docs.netlify.com/configure-builds/environment-variables/#read-only-variables */
const NETLIFY_PREVIEW_SITE = process.env.CONTEXT !== 'production' && process.env.DEPLOY_PRIME_URL;
const site = NETLIFY_PREVIEW_SITE || 'https://docs.astro.build/';
// https://astro.build/config
export default defineConfig({
site,
integrations: [
starlight({
title: 'Docs',
customCss: ['./src/styles/custom.css'],
expressiveCode: {
plugins: [pluginCollapsibleSections()],
},
components: {
EditLink: './src/components/starlight/EditLink.astro',
Head: './src/components/starlight/Head.astro',
Hero: './src/components/starlight/Hero.astro',
MarkdownContent: './src/components/starlight/MarkdownContent.astro',
MobileTableOfContents: './src/components/starlight/MobileTableOfContents.astro',
TableOfContents: './src/components/starlight/TableOfContents.astro',
PageSidebar: './src/components/starlight/PageSidebar.astro',
Pagination: './src/components/starlight/Pagination.astro',
Footer: './src/components/starlight/Footer.astro',
SiteTitle: './src/components/starlight/SiteTitle.astro',
Search: './src/components/starlight/Search.astro',
Sidebar: './src/components/starlight/Sidebar.astro',
MobileMenuFooter: './src/components/starlight/MobileMenuFooter.astro',
PageTitle: './src/components/starlight/PageTitle.astro',
},
editLink: {
baseUrl: 'https://github.com/withastro/docs/edit/main',
},
defaultLocale: 'en',
locales: makeLocalesConfig(),
sidebar: makeSidebar(),
social: {
github: 'https://github.com/withastro/astro',
discord: 'https://astro.build/chat',
},
pagefind: false,
head: [
// Add ICO favicon fallback for Safari.
{
tag: 'link',
attrs: {
rel: 'icon',
href: '/favicon.ico',
sizes: '32x32',
},
},
],
disable404Route: true,
}),
sitemap(),
],
trailingSlash: 'always',
scopedStyleStrategy: 'where',
compressHTML: false,
markdown: {
// Override with our own config
smartypants: false,
remarkPlugins: [
[remarkSmartypants, { dashes: false }],
// Add our custom plugin that marks links to fallback language pages
remarkFallbackLang(),
],
rehypePlugins: [
rehypeSlug,
// This adds links to headings
...rehypeAutolink(),
// Tweak GFM task list syntax
rehypeTasklistEnhancer(),
],
},
image: {
domains: ['avatars.githubusercontent.com'],
service: sharpImageService(),
},
experimental: {
contentCollectionCache: false,
directRenderScript: true,
},
});