forked from AscensionGameDev/Intersect-Documentation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
astro.config.ts
81 lines (75 loc) · 2.17 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
import { defineConfig } from 'astro/config';
import mdx from '@astrojs/mdx';
import preact from '@astrojs/preact';
import sitemap from '@astrojs/sitemap';
import rehypeAutolinkHeadings, {
Options as RehypeAutolinkHeadingsOptions
} from 'rehype-autolink-headings';
import rehypeSlug from 'rehype-slug';
import rehypeVideo from '@ascensiongamedev/rehype-video';
import remarkLint from 'remark-lint';
import remarkReferenceLinks from 'remark-reference-links';
import remarkValidateLinks from 'remark-validate-links';
import rehypeRewriteUrls from './plugins/rehype-rewrite-urls';
import { h } from 'hastscript';
import { fromHtml } from 'hast-util-from-html';
import { readFileSync } from 'fs';
import { join } from 'path';
const linkIconSvgPath = join(process.cwd(), 'public', 'link.svg');
const linkIcon = readFileSync(linkIconSvgPath, 'utf-8');
// Would like to add but are "unmaintained":
// rehype-minify-url https://github.com/rehypejs/rehype-minify/tree/main/packages/rehype-minify-url
// remark-a11y-emoji https://github.com/florianeckerstorfer/remark-a11y-emoji
// Would like to add but are "dead":
// remark-lint-no-dead-urls https://github.com/davidtheclark/remark-lint-no-dead-urls
// remark-relative-links https://github.com/zslabs/remark-relative-links
// https://astro.build/config
export default defineConfig({
integrations: [
mdx(),
// Enable Preact to support Preact JSX components.
preact(),
sitemap({
i18n: {
defaultLocale: 'en-US',
locales: {
'en-US': 'en-US',
es: 'es',
fr: 'fr',
it: 'it',
nl: 'nl',
'pt-BR': 'pt-BR',
},
},
}),
],
markdown: {
gfm: true,
rehypePlugins: [
rehypeRewriteUrls,
rehypeSlug,
rehypeVideo,
[
/* this order matters, it must come after rehypeSlug */
rehypeAutolinkHeadings,
<RehypeAutolinkHeadingsOptions>{
behavior: 'append',
content() {
return h(
'span',
{ class: 'icon icon-link' },
fromHtml(linkIcon).children.filter(({ type }) => type === 'element')
);
}
}
]
],
remarkPlugins: [
remarkLint,
remarkReferenceLinks,
remarkValidateLinks
],
},
site: 'https://docs.freemmorpgmaker.com/',
trailingSlash: 'always',
});