forked from microsoft/typespec
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathastro.config.mjs
73 lines (71 loc) · 2.05 KB
/
astro.config.mjs
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
// @ts-check
import react from "@astrojs/react";
import starlight from "@astrojs/starlight";
import tailwind from "@astrojs/tailwind";
import { TypeSpecLang } from "@typespec/astro-utils/shiki";
import { processSidebar } from "@typespec/astro-utils/sidebar";
import astroExpressiveCode from "astro-expressive-code";
import rehypeAstroRelativeMarkdownLinks from "astro-rehype-relative-markdown-links";
import { defineConfig } from "astro/config";
import { resolve } from "path";
import rehypeMermaid from "rehype-mermaid";
import remarkHeadingID from "remark-heading-id";
import current from "./src/content/current-sidebar";
const base = process.env.TYPESPEC_WEBSITE_BASE_PATH ?? "/";
// https://astro.build/config
export default defineConfig({
base,
site: "https://typespec.io",
trailingSlash: "always",
integrations: [
astroExpressiveCode(),
starlight({
title: "TypeSpec",
sidebar: await processSidebar(
resolve(import.meta.dirname, "src/content/docs"),
"docs",
current,
),
favicon: "/img/favicon.svg",
customCss: ["./src/css/custom.css"],
components: {
Header: "./src/components/header/header.astro",
PageFrame: "./src/components/starlight-overrides/PageFrame.astro",
},
expressiveCode: false, // defined directly above
head: [
{
tag: "script",
attrs: {
src: "https://consentdeliveryfd.azurefd.net/mscc/lib/v2/wcp-consent.js",
},
},
{
tag: "script",
attrs: {
type: "module",
async: true,
src: "1ds-init.js",
},
},
],
plugins: [],
}),
react(),
tailwind({ applyBaseStyles: false }),
],
markdown: {
// @ts-expect-error wrong type
remarkPlugins: [remarkHeadingID],
rehypePlugins: [
rehypeMermaid,
[
rehypeAstroRelativeMarkdownLinks,
{ base, contentPath: "src/content/docs", trailingSlash: "always" },
],
],
shikiConfig: {
langs: [TypeSpecLang],
},
},
});