-
Notifications
You must be signed in to change notification settings - Fork 946
Expand file tree
/
Copy pathastro.config.mjs
More file actions
213 lines (211 loc) · 8.84 KB
/
Copy pathastro.config.mjs
File metadata and controls
213 lines (211 loc) · 8.84 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
208
209
210
211
212
213
// Copyright © SixtyFPS GmbH <info@slint.dev>
// SPDX-License-Identifier: MIT
// @ts-check
import { defineConfig } from "astro/config";
import starlight from "@astrojs/starlight";
import mermaid from "astro-mermaid";
import {
SLINT_STARLIGHT_TRAILING_SLASH,
slintStarlightLinksValidatorPlugin,
} from "@slint/common-files/src/utils/starlight-site-defaults";
import { rehypeExternalLinksSlint } from "@slint/common-files/src/utils/rehype-external-links-preset";
import { slintStarlightSocial } from "@slint/common-files/src/utils/starlight-social";
import {
SAFETY_DOCS_BASE_URL,
SAFETY_DOCS_BASE_PATH,
} from "./src/safety-site-config.mjs";
import rehypeSlsIds from "@slint/common-files/src/utils/rehype-sls-ids.mjs";
import remarkBaseLinks from "@slint/common-files/src/utils/remark-base-links.mjs";
const _safetyOrigin = String(SAFETY_DOCS_BASE_URL).replace(/\/+$/, "");
const _safetyAtRoot = SAFETY_DOCS_BASE_PATH === "/";
const _safetySite = _safetyAtRoot
? _safetyOrigin
: `${_safetyOrigin}${SAFETY_DOCS_BASE_PATH.replace(/\/*$/, "/")}`;
const _safetyBase = _safetyAtRoot
? undefined
: SAFETY_DOCS_BASE_PATH.replace(/\/*$/, "/");
// https://astro.build/config
export default defineConfig({
site: _safetySite,
...(_safetyBase ? { base: _safetyBase } : {}),
trailingSlash: SLINT_STARLIGHT_TRAILING_SLASH,
markdown: {
// Only SC-covered content reaches this site's generated reference, so
// every paragraph of it carries a traceability id.
remarkPlugins: [[remarkBaseLinks, { base: _safetyBase ?? "/" }]],
rehypePlugins: [
rehypeExternalLinksSlint,
[rehypeSlsIds, { referenceRequiresIds: true }],
],
},
integrations: [
mermaid(),
starlight({
title: "Slint SC Safety Manual",
customCss: [
"@slint/common-files/src/styles/starlight-slint-custom.css",
"@slint/common-files/src/styles/starlight-slint-theme.css",
"@slint/common-files/src/styles/sls-ids.css",
],
components: {
Footer: "@slint/common-files/src/components/Footer.astro",
Header: "@slint/common-files/src/components/Header.astro",
Banner: "@slint/common-files/src/components/Banner.astro",
},
plugins: [slintStarlightLinksValidatorPlugin({ errorOnRelativeLinks: true })],
social: slintStarlightSocial,
sidebar: [
{ label: "Slint SC Safety Manual", slug: "index" },
{ label: "Safety Policy", slug: "safety-policy" },
{
label: "Requirements",
items: [
{
label: "ISO 26262 Requirements",
slug: "requirements",
},
{
label: "SR_SAFE_RUST_CODING_STANDARDS",
slug: "requirements/coding-standards",
},
{
label: "SR_STATIC_MEMORY_ALLOCATION",
slug: "requirements/memory-allocation",
},
{
label: "SR_BOUNDED_EXECUTION_TIME",
slug: "requirements/bounded-execution",
},
{
label: "SR_STATE_MACHINE_DETERMINISM",
slug: "requirements/state-machine",
},
{
label: "SR_RESOURCE_FALLBACK",
slug: "requirements/resource-fallback",
},
{
label: "SR_CODE_GENERATION",
slug: "requirements/code-generation",
},
{
label: "SR_TEST_COVERAGE",
slug: "requirements/test-coverage",
},
{
label: "SR_SEPARATION_OF_CONCERNS",
slug: "requirements/separation-of-concerns",
},
{
label: "SR_CONCURRENCY_CONTROL",
slug: "requirements/concurrency-control",
},
],
},
{ label: "Using Slint SC", slug: "using-slint-sc" },
{
label: "Reference",
items: [
{ label: "Overview", slug: "reference" },
{
label: "Generated Code",
slug: "reference/generated-code",
},
{ label: "Rendering", slug: "reference/rendering" },
{
label: "Elements",
items: [
{ label: "Rectangle", slug: "reference/rectangle" },
{ label: "Window", slug: "reference/window" },
],
},
{
label: "Property Types",
items: [
{
label: "Colors & Brushes",
slug: "reference/property-types/colors-and-brushes",
},
{
label: "Numeric Types",
slug: "reference/property-types/numeric-types",
},
],
},
],
},
{ label: "Development Process", slug: "development-process" },
{ label: "Development Phases", slug: "development-phases" },
{
label: "Qualification Plan",
items: [
{
label: "Qualification Plan",
slug: "qualification-plan",
},
{
label: "Failure Scenarios",
slug: "qualification-plan/failure-scenarios",
},
{
label: "Known Issues",
slug: "qualification-plan/known-issues",
},
{
label: "Test Cases",
slug: "qualification-plan/test-cases",
},
{
label: "Validation",
slug: "qualification-plan/validation",
},
{
label: "Traceability Matrix",
slug: "qualification-plan/traceability-matrix",
},
],
},
{
label: "Language Specification",
items: [
{ label: "Introduction", slug: "language" },
{
label: "Source Files",
slug: "language/source-files",
},
{
label: "Lexical Structure",
slug: "language/lexical-structure",
},
{
label: "File Structure",
slug: "language/file-structure",
},
// The Imports chapter is marked notInSC; list it here
// once imports come into the SC subset.
{
label: "Exports",
slug: "language/exports",
},
{
label: "Properties",
slug: "language/properties",
},
{
label: "Bindings",
slug: "language/bindings",
},
{
label: "Expressions",
slug: "language/expressions",
},
{
label: "Geometry",
slug: "language/geometry",
},
],
},
],
}),
],
});