forked from withastro/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
astro.config.ts
101 lines (98 loc) · 3.38 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
import starlight from '@astrojs/starlight';
import { pluginCollapsibleSections } from '@expressive-code/plugin-collapsible-sections';
import { defineConfig, sharpImageService } from 'astro/config';
import rehypeSlug from 'rehype-slug';
import remarkSmartypants from 'remark-smartypants';
import { sidebar } from './astro.sidebar';
import { devServerFileWatcher } from './config/integrations/dev-server-file-watcher';
import { sitemap } from './config/integrations/sitemap';
import { makeLocalesConfig } from './config/locales';
import { starlightPluginAutolinkHeadings } from './config/plugins/rehype-autolink';
import { rehypeTasklistEnhancer } from './config/plugins/rehype-tasklist-enhancer';
import { remarkFallbackLang } from './config/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: [
devServerFileWatcher([
'./config/*', // Custom plugins and integrations
'./astro.sidebar.ts', // Sidebar configuration file
'./src/content/nav/*.ts', // Sidebar labels
]),
starlight({
title: 'Docs',
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,
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,
plugins: [starlightPluginAutolinkHeadings()],
}),
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,
// Tweak GFM task list syntax
rehypeTasklistEnhancer(),
],
},
image: {
domains: ['avatars.githubusercontent.com'],
service: sharpImageService(),
},
experimental: {
contentCollectionCache: false,
directRenderScript: true,
},
});