-
Notifications
You must be signed in to change notification settings - Fork 291
Expand file tree
/
Copy pathastro.config.base.mjs
More file actions
207 lines (206 loc) · 6.59 KB
/
astro.config.base.mjs
File metadata and controls
207 lines (206 loc) · 6.59 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
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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
import admonitionsPlugin from "./bin/remark-admonitions";
import { mermaid } from "./bin/remark-mermaid.ts";
import { rehypeCheckboxParser } from "./bin/rehype-checkbox-parser.ts";
import { rehypeHeadingNumbers } from "./bin/rehype-heading-numbers.ts";
import mdx from "@astrojs/mdx";
import netlify from "@astrojs/netlify";
import partytown from "@astrojs/partytown";
import sitemap from "@astrojs/sitemap";
import svelte from "@astrojs/svelte";
import yaml from "@rollup/plugin-yaml";
import { envField, fontProviders } from "astro/config";
import { h } from "hastscript";
import addClasses from "rehype-class-names";
import rehypeAutolinkHeadings from "rehype-autolink-headings";
import rehypeKatex from "rehype-katex";
import rehypePrettyCode from "rehype-pretty-code";
import { transformerNotationDiff } from "@shikijs/transformers";
import rehypeSlug from "rehype-slug";
import urls from "rehype-urls";
import rehypeWrap from "rehype-wrap-all";
import remarkDirective from "remark-directive";
import emoji from "remark-emoji";
import remarkGfm from "remark-gfm";
import remarkMath from "remark-math";
import markdownIntegration from "@mashehu/astropub-md";
import icon from "astro-icon";
/**
* Base Astro configuration shared across all nf-core subsites.
* Import this and spread it into defineConfig() along with site-specific overrides.
*/
export default {
site: "https://nf-co.re/",
output: "static",
adapter: netlify(),
prefetch: false,
env: {
schema: {
GITHUB_TOKEN: envField.string({
context: "server",
access: "secret",
optional: false,
}),
},
},
fonts: [
{
provider: fontProviders.fontsource(),
name: "Inter",
cssVariable: "--font-inter",
fallbacks: ["sans-serif"],
weights: ["300 700"],
},
{
provider: fontProviders.fontsource(),
name: "Maven Pro",
cssVariable: "--font-maven-pro",
fallbacks: ["sans-serif"],
weights: ["300 700"],
},
],
experimental: {
svgo: true,
},
integrations: [
svelte(),
icon({
include: {
"file-icons": ["nextflow"],
logos: [
"twitter",
"mastodon-icon",
"slack-icon",
"aws",
"microsoft-azure",
"github-actions",
"youtube-icon",
"linkedin",
],
fa: ["github"],
"fa-brands": ["github"],
mdi: ["aws", "slack", "youtube", "hammer-wrench", "sprout"],
octicon: [
"chevron-right-16",
"git-pull-request-16",
"law-16",
"link-external-16",
"mortar-board-16",
"play-16",
"table-16",
"tasklist-16",
"terminal-16",
"tools-16",
"question-16",
"book-16",
],
"simple-icons": ["bluesky"],
},
}),
sitemap(),
partytown({
config: {
forward: ["dataLayer.push"],
},
}),
mdx(),
markdownIntegration(),
],
build: {
inlineStylesheets: "auto",
format: "file",
},
vite: {
plugins: [yaml()],
ssr: {
noExternal: ["@popperjs/core", "svelte-exmarkdown", "svelte-confetti", "@mashehu/astropub-md"],
},
resolve: {
preserveSymlinks: true,
browser: true,
noExternal: ["@popperjs/core", "svelte-exmarkdown", "svelte-confetti", "@mashehu/astropub-md"],
},
css: {
preprocessorOptions: {
scss: {
silenceDeprecations: [
"legacy-js-api",
"color-functions",
"global-builtin",
"import",
"if-function",
],
},
},
},
},
image: {
domains: [
"raw.githubusercontent.com",
"unsplash.com",
"avatars.githubusercontent.com",
"github.com",
"nf-core-docs.netlify.app",
"nf-core-main-site.netlify.app",
],
service: {
entrypoint: "astro/assets/services/sharp",
},
},
markdown: {
syntaxHighlight: false,
remarkPlugins: [emoji, remarkGfm, remarkDirective, admonitionsPlugin, mermaid, remarkMath],
rehypePlugins: [
rehypeSlug,
[
rehypeAutolinkHeadings,
{
behavior: "append",
content: h("i.ms-1.fas.fa-link.fa-xs.invisible"),
},
],
[
addClasses,
{
table: "table table-hover table-sm small",
},
],
[
rehypeWrap,
{
selector: "table",
wrapper: "div.table-responsive",
},
],
[
urls,
(url) => {
const regex = /^https:\/\/(raw.)*github/;
if (!regex.test(url.href) && url.href?.endsWith(".md")) {
url.href = url.href.replace(/\.md$/, "/");
url.pathname = url.pathname.replace(/\.md$/, "/");
url.path = url.path.replace(/\.md$/, "/");
} else if (!regex.test(url.href) && url.href?.endsWith(".mdx")) {
url.href = url.href.replace(/\.mdx$/, "/");
url.pathname = url.pathname.replace(/\.mdx$/, "/");
url.path = url.path.replace(/\.mdx$/, "/");
}
},
],
rehypeCheckboxParser,
rehypeHeadingNumbers,
[
rehypePrettyCode,
{
defaultLang: "plaintext",
keepBackground: true,
theme: {
dark: "github-dark-dimmed",
light: "github-light",
},
transformers: [transformerNotationDiff()],
},
],
[rehypeKatex, { strict: false }],
],
},
};