@astrojs/starlight 0.36.2 → 0.36.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +15 -2
- package/integrations/expressive-code/themes/night-owl-dark.jsonc +4 -4
- package/integrations/expressive-code/themes/night-owl-light.jsonc +4 -4
- package/package.json +4 -2
- package/schemas/i18n.ts +1 -1
- package/user-components/file-tree-icons.ts +1 -1
- package/utils/head.ts +9 -3
- package/utils/i18n.ts +4 -4
- package/utils/starlight-page.ts +1 -1
- package/utils/user-config.ts +18 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @astrojs/starlight
|
|
2
2
|
|
|
3
|
+
## 0.36.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#3555](https://github.com/withastro/starlight/pull/3555) [`547dc30`](https://github.com/withastro/starlight/commit/547dc30558b388bfc0505ab0fd8269cecaed462a) Thanks [@Its-Just-Nans](https://github.com/Its-Just-Nans)! - Improves the error message thrown when using a file in the `public/` directory with Starlight’s `customCss` configuration option
|
|
8
|
+
|
|
9
|
+
- [#3496](https://github.com/withastro/starlight/pull/3496) [`b78fda4`](https://github.com/withastro/starlight/commit/b78fda45be17be7a260309251e82504f9ac8e97a) Thanks [@delucis](https://github.com/delucis)! - Fixes invalid `<head>` output when configuration is missing:
|
|
10
|
+
|
|
11
|
+
- Omits `<meta property="og:description" />` if Starlight’s `description` option is unset
|
|
12
|
+
- Omits `<link rel="canonical" />` and `<meta property="og:url" />` if Astro’s `site` option is unset
|
|
13
|
+
|
|
14
|
+
- [#3511](https://github.com/withastro/starlight/pull/3511) [`8727df1`](https://github.com/withastro/starlight/commit/8727df1a1b1c82f1303613226000afd53ffe4e36) Thanks [@astrobot-houston](https://github.com/astrobot-houston)! - Updates the `seti:gitlab` icon to match latest version from Seti UI Icons
|
|
15
|
+
|
|
3
16
|
## 0.36.2
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
|
@@ -30,7 +43,7 @@
|
|
|
30
43
|
|
|
31
44
|
- [#3427](https://github.com/withastro/starlight/pull/3427) [`c3b2d0f`](https://github.com/withastro/starlight/commit/c3b2d0fc37bb9b7b6abc6c11b760a4114690ccd4) Thanks [@delucis](https://github.com/delucis)! - Fixes styling of labels that wrap across multiple lines in `<Tabs>` component
|
|
32
45
|
|
|
33
|
-
⚠️ **Potentially breaking change:** Tab labels now have a narrower line-height and additional vertical padding. If you have custom CSS
|
|
46
|
+
⚠️ **Potentially breaking change:** Tab labels now have a narrower line-height and additional vertical padding. If you have custom CSS targeting the `<Tabs>` component, you may want to double check the visual appearance of your tabs when updating.
|
|
34
47
|
|
|
35
48
|
If you want to preserve the previous styling, you can add the following custom CSS to your site:
|
|
36
49
|
|
|
@@ -182,7 +195,7 @@
|
|
|
182
195
|
|
|
183
196
|
- [#3181](https://github.com/withastro/starlight/pull/3181) [`449c822`](https://github.com/withastro/starlight/commit/449c8229effaab19ece3c0a34e32595809c33cc8) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Fixes an issue where all headings in Markdown and MDX content were rendered with a [clickable anchor link](https://starlight.astro.build/reference/configuration/#headinglinks), even in non-Starlight pages.
|
|
184
197
|
|
|
185
|
-
- [#3168](https://github.com/withastro/starlight/pull/3168) [`ca693fe`](https://github.com/withastro/starlight/commit/ca693feb4b6aa9f26b3d536d284288773b788ac6) Thanks [@jsparkdev](https://github.com/jsparkdev)! - Updates Korean
|
|
198
|
+
- [#3168](https://github.com/withastro/starlight/pull/3168) [`ca693fe`](https://github.com/withastro/starlight/commit/ca693feb4b6aa9f26b3d536d284288773b788ac6) Thanks [@jsparkdev](https://github.com/jsparkdev)! - Updates Korean language support with improvements and missing translations
|
|
186
199
|
|
|
187
200
|
## 0.34.2
|
|
188
201
|
|
|
@@ -896,7 +896,7 @@
|
|
|
896
896
|
},
|
|
897
897
|
},
|
|
898
898
|
{
|
|
899
|
-
"name": "
|
|
899
|
+
"name": "Backticks(``) in Template Strings",
|
|
900
900
|
"scope": "string.template punctuation.definition.string",
|
|
901
901
|
"settings": {
|
|
902
902
|
"foreground": "#d6deeb",
|
|
@@ -934,14 +934,14 @@
|
|
|
934
934
|
},
|
|
935
935
|
},
|
|
936
936
|
{
|
|
937
|
-
"name": "
|
|
937
|
+
"name": "CoffeeScript Variable Assignment",
|
|
938
938
|
"scope": "variable.assignment.coffee",
|
|
939
939
|
"settings": {
|
|
940
940
|
"foreground": "#31e1eb",
|
|
941
941
|
},
|
|
942
942
|
},
|
|
943
943
|
{
|
|
944
|
-
"name": "
|
|
944
|
+
"name": "CoffeeScript Parameter Function",
|
|
945
945
|
"scope": "variable.parameter.function.coffee",
|
|
946
946
|
"settings": {
|
|
947
947
|
"foreground": "#d6deeb",
|
|
@@ -1781,7 +1781,7 @@
|
|
|
1781
1781
|
"keyword.operator.type",
|
|
1782
1782
|
"keyword.operator",
|
|
1783
1783
|
"keyword",
|
|
1784
|
-
"punctuation.
|
|
1784
|
+
"punctuation.definition.string",
|
|
1785
1785
|
"punctuation",
|
|
1786
1786
|
"variable.other.readwrite.js",
|
|
1787
1787
|
"storage.type",
|
|
@@ -839,7 +839,7 @@
|
|
|
839
839
|
},
|
|
840
840
|
},
|
|
841
841
|
{
|
|
842
|
-
"name": "
|
|
842
|
+
"name": "Backticks(``) in Template Strings",
|
|
843
843
|
"scope": "string.template punctuation.definition.string",
|
|
844
844
|
"settings": {
|
|
845
845
|
"foreground": "#403f53",
|
|
@@ -876,14 +876,14 @@
|
|
|
876
876
|
},
|
|
877
877
|
},
|
|
878
878
|
{
|
|
879
|
-
"name": "
|
|
879
|
+
"name": "CoffeeScript Variable Assignment",
|
|
880
880
|
"scope": "variable.assignment.coffee",
|
|
881
881
|
"settings": {
|
|
882
882
|
"foreground": "#31e1eb",
|
|
883
883
|
},
|
|
884
884
|
},
|
|
885
885
|
{
|
|
886
|
-
"name": "
|
|
886
|
+
"name": "CoffeeScript Parameter Function",
|
|
887
887
|
"scope": "variable.parameter.function.coffee",
|
|
888
888
|
"settings": {
|
|
889
889
|
"foreground": "#403f53",
|
|
@@ -1680,7 +1680,7 @@
|
|
|
1680
1680
|
"keyword.operator.type",
|
|
1681
1681
|
"keyword.operator",
|
|
1682
1682
|
"keyword",
|
|
1683
|
-
"punctuation.
|
|
1683
|
+
"punctuation.definition.string",
|
|
1684
1684
|
"punctuation",
|
|
1685
1685
|
"variable.other.readwrite.js",
|
|
1686
1686
|
"storage.type",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrojs/starlight",
|
|
3
|
-
"version": "0.36.
|
|
3
|
+
"version": "0.36.3",
|
|
4
4
|
"description": "Build beautiful, high-performance documentation websites with Astro",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"docs",
|
|
@@ -223,6 +223,8 @@
|
|
|
223
223
|
"test": "vitest",
|
|
224
224
|
"test:legacy": "LEGACY_COLLECTIONS=true vitest",
|
|
225
225
|
"test:coverage": "vitest run --coverage",
|
|
226
|
-
"test:e2e": "
|
|
226
|
+
"test:e2e": "pnpm test:e2e:chrome",
|
|
227
|
+
"test:e2e:chrome": "playwright install --with-deps chromium && playwright test --project chrome",
|
|
228
|
+
"test:e2e:firefox": "playwright install --with-deps firefox && playwright test --project firefox"
|
|
227
229
|
}
|
|
228
230
|
}
|
package/schemas/i18n.ts
CHANGED
|
@@ -104,7 +104,7 @@ function starlightI18nSchema() {
|
|
|
104
104
|
'sidebarNav.accessibleLabel': z
|
|
105
105
|
.string()
|
|
106
106
|
.describe(
|
|
107
|
-
'Accessible label for the main sidebar `<nav>` element to distinguish it
|
|
107
|
+
'Accessible label for the main sidebar `<nav>` element to distinguish it from other `<nav>` landmarks on the page.'
|
|
108
108
|
),
|
|
109
109
|
|
|
110
110
|
'tableOfContents.onThisPage': z
|
|
@@ -750,7 +750,7 @@ export const FileIcons = {
|
|
|
750
750
|
'seti:firefox':
|
|
751
751
|
'<path d="M23.928 10.888L23.886 10.594Q23.718 9.544 23.634 8.998L23.634 8.998L23.214 9.880L23.130 9.880Q23.550 6.058 20.946 3.790L20.946 3.790L20.862 4.000Q20.442 3.454 19.434 2.740L19.434 2.740Q19.308 3.118 19.644 3.454L19.644 3.454Q20.862 4.546 21.576 5.806L21.576 5.806L21.702 6.016Q21.282 5.428 20.232 4.420L20.232 4.420L19.812 4.000Q18.636 2.740 16.746 2.152L16.746 2.152L16.200 1.984L16.662 2.404Q17.544 3.076 17.964 3.454L17.964 3.454Q18.468 3.958 18.909 4.525Q19.350 5.092 19.392 5.302L19.392 5.302Q18.342 4.462 17.376 4.378L17.376 4.378Q19.980 6.730 19.686 10.132L19.686 10.132Q19.308 9.418 18.720 9.040L18.720 9.040L18.888 10.636Q19.014 11.854 18.888 12.484L18.888 12.484L18.636 13.618L18.342 13.030L18.216 13.618Q17.964 14.542 17.838 15.004L17.838 15.004Q17.544 16.054 16.872 16.684L16.872 16.684Q16.704 16.810 16.494 16.936L16.494 16.936Q16.452 16.978 16.368 16.978L16.368 16.978L16.284 16.978L16.284 16.684L16.200 16.684Q16.074 16.684 16.032 16.726L16.032 16.726Q15.864 16.894 15.696 17.062L15.696 17.062Q15.402 17.482 14.898 17.776L14.898 17.776L14.982 17.440L13.890 17.692Q13.218 17.818 12.882 17.860L12.882 17.860Q12.336 17.944 11.874 17.860L11.874 17.860Q11.160 17.734 10.824 17.356L10.824 17.356L11.538 17.356Q11.412 17.230 11.286 17.188L11.286 17.188L10.026 16.894Q9.438 16.726 9.165 16.558Q8.892 16.390 8.430 15.886L8.430 15.886L8.346 15.802Q7.044 14.542 7.338 12.484L7.338 12.484Q7.422 11.854 7.506 11.560L7.506 11.560Q7.674 11.098 8.052 10.804L8.052 10.804Q7.632 10.510 7.170 10.510L7.170 10.510Q6.498 10.468 5.910 10.909Q5.322 11.350 5.112 12.022L5.112 12.022Q4.566 13.618 5.742 15.172L5.742 15.172L5.868 15.340Q5.112 14.710 4.839 13.639Q4.566 12.568 4.986 11.602L4.986 11.602Q5.322 10.804 6.015 10.405Q6.708 10.006 7.485 10.132Q8.262 10.258 8.850 10.846L8.850 10.846L9.060 11.098Q9.186 10.720 9.165 10.237Q9.144 9.754 8.934 9.460L8.934 9.460Q7.884 8.032 8.199 6.457Q8.514 4.882 9.774 3.664L9.774 3.664L9.942 3.496Q9.060 3.286 8.094 3.874Q7.128 4.462 6.204 5.722L6.204 5.722L6.372 4.714L6.036 4.672Q4.104 4.420 2.634 5.638L2.634 5.638Q1.206 6.772 0.576 8.830L0.576 8.830L0.072 10.636L0.114 10.636L0.450 10.132Q0.282 11.056 0.198 12.148Q0.114 13.240 0.156 13.786L0.156 13.786L0.408 13.030Q0.954 17.062 3.516 19.750L3.516 19.750Q4.776 21.052 6.855 22.249Q8.934 23.446 9.858 23.362L9.858 23.362L9.396 23.068Q9.648 23.110 10.110 23.236L10.110 23.236L10.530 23.320L11.916 23.656L12.672 23.656L12.294 23.320L13.596 23.236Q15.528 23.110 17.418 22.438L17.418 22.438Q17.964 22.270 18.468 21.808L18.468 21.808Q18.804 21.472 19.266 20.884L19.266 20.884Q19.434 20.632 19.644 20.506L19.644 20.506Q21.492 19.498 22.542 17.608L22.542 17.608Q23.046 16.726 22.794 15.592L22.794 15.592Q22.752 15.382 22.836 15.172L22.836 15.172L23.088 14.584Q23.382 13.996 23.487 13.681Q23.592 13.366 23.760 12.694L23.760 12.694L23.928 12.064L23.928 10.888ZM8.178 12.946L7.800 12.694Q7.632 13.618 8.052 14.542Q8.472 15.466 9.270 15.928L9.270 15.928Q9.354 15.970 9.480 15.970L9.480 15.970Q11.412 16.096 12.798 14.962L12.798 14.962L13.092 14.710Q13.470 14.374 14.058 14.458L14.058 14.458Q14.268 14.500 14.373 14.395Q14.478 14.290 14.436 14.080L14.436 14.080Q14.352 13.618 13.932 13.366L13.932 13.366Q12.630 12.694 11.412 13.366L11.412 13.366Q11.076 13.576 10.740 13.660L10.740 13.660Q9.942 13.870 9.018 13.408L9.018 13.408Q8.766 13.282 8.178 12.946L8.178 12.946ZM3.894 4.126L3.978 4.084Q4.062 4.000 4.104 3.958L4.104 3.958Q8.430-0.074 14.100 1.102L14.100 1.102Q15.024 1.312 16.830 1.858L16.830 1.858L18.006 2.194Q15.822 0.682 13.134 0.409Q10.446 0.136 7.905 1.018Q5.364 1.900 3.558 3.832L3.558 3.832L3.894 4.126ZM11.664 7.234L11.664 7.234Q11.706 6.982 11.622 6.898Q11.538 6.814 11.328 6.772L11.328 6.772Q10.908 6.730 10.026 6.730L10.026 6.730L9.816 6.730Q9.438 6.688 9.270 6.646L9.270 6.646Q8.934 6.604 8.724 6.352L8.724 6.352Q8.472 6.940 8.682 7.864Q8.892 8.788 9.354 9.208L9.354 9.208L9.858 8.914Q10.614 8.494 11.034 8.284L11.034 8.284Q11.622 7.990 11.664 7.234ZM3.642 4.420L3.642 4.420Q2.844 3.748 2.760 2.614L2.760 2.614Q2.130 3.286 1.836 4.168L1.836 4.168Q1.626 4.882 1.584 5.890L1.584 5.890Q2.550 4.882 3.642 4.420Z"/>',
|
|
752
752
|
'seti:gitlab':
|
|
753
|
-
'<path d="
|
|
753
|
+
'<path d="M23.424 9.639L23.424 9.639L23.382 9.555L20.190 1.155Q20.064 0.903 19.833 0.756Q19.602 0.609 19.329 0.630Q19.056 0.651 18.846 0.819Q18.636 0.987 18.552 1.239L18.552 1.239L16.410 7.875L7.590 7.875L5.448 1.239Q5.364 0.987 5.154 0.819Q4.944 0.651 4.671 0.630Q4.398 0.609 4.167 0.756Q3.936 0.903 3.852 1.155L3.852 1.155L0.576 9.597Q-0.138 11.487 0.408 13.398Q0.954 15.309 2.550 16.527L2.550 16.527L7.506 20.223L11.412 23.163Q11.664 23.373 12.000 23.373Q12.336 23.373 12.588 23.163L12.588 23.163L21.450 16.527Q23.046 15.309 23.592 13.398Q24.138 11.487 23.424 9.639Z"/>',
|
|
754
754
|
'seti:grunt':
|
|
755
755
|
'<path d="M19.485 12.265L19.485 12.265Q19.596 12.228 19.855 12.117L19.855 12.117Q20.632 11.747 21.002 11.488L21.002 11.488Q21.483 11.118 21.668 10.637Q21.853 10.156 21.668 9.712Q21.483 9.268 21.002 9.046L21.002 9.046Q20.706 8.898 20.521 8.343L20.521 8.343Q20.373 7.344 20.891 6.493L20.891 6.493Q21.483 5.642 21.113 5.013Q20.743 4.384 19.596 4.310L19.596 4.310L19.485 4.310L19.374 4.199L19.374 4.125Q19.263 3.607 19.300 3.385L19.300 3.385Q19.374 2.978 19.818 2.682L19.818 2.682Q20.077 2.571 20.743 2.349L20.743 2.349Q21.002 2.238 21.335 2.238L21.335 2.238Q21.335 2.090 21.224 2.090L21.224 2.090L21.224 2.090Q20.669 1.461 19.818 1.202L19.818 1.202Q19.078 0.980 18.227 1.054L18.227 1.054Q17.265 1.165 16.488 1.646L16.488 1.646Q15.896 2.016 15.193 2.793L15.193 2.793Q15.045 3.126 14.638 2.904L14.638 2.904Q14.416 2.793 14.416 2.571L14.416 2.571Q14.416 2.460 14.471 2.220Q14.527 1.979 14.527 1.868L14.527 1.868L14.860 1.165Q14.453 1.165 14.046 1.350L14.046 1.350Q13.824 1.461 13.343 1.757L13.343 1.757L13.121 1.868Q12.862 1.461 12.843 1.091Q12.825 0.721 13.010 0.240L13.010 0.240Q12.159 0.536 11.715 0.906L11.715 0.906Q11.197 1.387 11.049 2.090L11.049 2.090Q10.864 1.942 10.827 1.646L10.827 1.646Q10.790 1.461 10.790 1.128L10.790 1.128L10.827 0.832L10.716 0.832Q10.642 0.832 10.586 0.888Q10.531 0.943 10.457 0.943L10.457 0.943Q9.606 1.646 9.421 2.571L9.421 2.571Q9.421 2.645 9.365 2.756Q9.310 2.867 9.310 2.904L9.310 2.904Q9.273 2.867 9.143 2.812Q9.014 2.756 8.977 2.682L8.977 2.682Q8.755 2.497 8.292 2.109Q7.830 1.720 7.571 1.535L7.571 1.535Q6.535 0.943 5.554 0.925Q4.574 0.906 3.538 1.424L3.538 1.424L2.613 2.349Q2.835 2.460 3.297 2.571Q3.760 2.682 3.982 2.793L3.982 2.793Q4.611 2.978 4.777 3.348Q4.944 3.718 4.685 4.421L4.685 4.421Q4.574 4.421 4.352 4.477Q4.130 4.532 3.982 4.532L3.982 4.532Q3.390 4.717 3.131 5.106Q2.872 5.494 2.946 6.049L2.946 6.049Q3.020 6.197 3.186 6.549Q3.353 6.900 3.427 7.085L3.427 7.085Q3.427 7.122 3.482 7.252Q3.538 7.381 3.538 7.418L3.538 7.418L3.538 8.602Q3.538 8.824 3.057 9.268L3.057 9.268L2.872 9.453Q2.465 9.823 2.391 10.082L2.391 10.082Q2.132 10.489 2.317 10.970Q2.502 11.451 2.946 11.821L2.946 11.821Q3.538 12.265 4.463 12.635L4.463 12.635Q5.388 13.079 5.388 14.004L5.388 14.004Q5.388 15.299 5.277 15.965L5.277 15.965Q5.277 16.076 5.203 16.372L5.203 16.372Q5.166 16.705 5.166 16.890L5.166 16.890Q4.574 16.446 4.259 15.984Q3.945 15.521 3.871 14.929L3.871 14.929Q2.835 15.817 2.835 16.779L2.835 16.779Q2.650 18.000 3.168 18.962L3.168 18.962Q3.723 19.998 5.055 20.479L5.055 20.479Q5.166 20.479 5.388 20.738L5.388 20.738Q6.424 22.440 8.496 22.810L8.496 22.810Q8.755 22.810 8.755 22.921L8.755 22.921Q9.643 23.476 10.642 23.661L10.642 23.661Q11.530 23.809 12.677 23.735L12.677 23.735Q13.417 23.624 13.787 23.513L13.787 23.513Q14.342 23.365 14.749 23.032L14.749 23.032Q14.823 22.995 14.989 22.921Q15.156 22.847 15.193 22.810L15.193 22.810Q17.117 22.477 18.227 20.849L18.227 20.849L18.560 20.479Q19.707 20.109 20.188 19.332L20.188 19.332Q20.595 18.777 20.743 18.000L20.743 18.000Q20.854 17.334 20.780 16.668L20.780 16.668Q20.669 16.187 20.428 15.799Q20.188 15.410 19.707 14.929L19.707 14.929Q19.559 15.558 19.263 16.021Q18.967 16.483 18.449 16.890L18.449 16.890Q18.338 15.854 18.338 13.893L18.338 13.893Q18.523 13.227 18.782 12.839Q19.041 12.450 19.485 12.265ZM14.971 18.407L9.791 18.407L14.971 18.407Z"/>',
|
|
756
756
|
'seti:gulp':
|
package/utils/head.ts
CHANGED
|
@@ -33,7 +33,9 @@ export function getHead(
|
|
|
33
33
|
attrs: { name: 'viewport', content: 'width=device-width, initial-scale=1' },
|
|
34
34
|
},
|
|
35
35
|
{ tag: 'title', content: `${data.title} ${config.titleDelimiter} ${siteTitle}` },
|
|
36
|
-
|
|
36
|
+
...(canonicalHref !== undefined
|
|
37
|
+
? ([{ tag: 'link', attrs: { rel: 'canonical', href: canonicalHref } }] as const)
|
|
38
|
+
: []),
|
|
37
39
|
{ tag: 'meta', attrs: { name: 'generator', content: context.generator } },
|
|
38
40
|
{
|
|
39
41
|
tag: 'meta',
|
|
@@ -51,9 +53,13 @@ export function getHead(
|
|
|
51
53
|
// OpenGraph Tags
|
|
52
54
|
{ tag: 'meta', attrs: { property: 'og:title', content: data.title } },
|
|
53
55
|
{ tag: 'meta', attrs: { property: 'og:type', content: 'article' } },
|
|
54
|
-
|
|
56
|
+
...(canonicalHref !== undefined
|
|
57
|
+
? ([{ tag: 'meta', attrs: { property: 'og:url', content: canonicalHref } }] as const)
|
|
58
|
+
: []),
|
|
55
59
|
{ tag: 'meta', attrs: { property: 'og:locale', content: lang } },
|
|
56
|
-
|
|
60
|
+
...(description !== undefined
|
|
61
|
+
? ([{ tag: 'meta', attrs: { property: 'og:description', content: description } }] as const)
|
|
62
|
+
: []),
|
|
57
63
|
{ tag: 'meta', attrs: { property: 'og:site_name', content: siteTitle } },
|
|
58
64
|
// Twitter Tags
|
|
59
65
|
{
|
package/utils/i18n.ts
CHANGED
|
@@ -11,7 +11,7 @@ import type { StarlightConfig } from './user-config';
|
|
|
11
11
|
*/
|
|
12
12
|
const wellKnownRTL = ['ar', 'fa', 'he', 'prs', 'ps', 'syc', 'ug', 'ur'];
|
|
13
13
|
|
|
14
|
-
/**
|
|
14
|
+
/** Information about the built-in default locale used as a fallback when no locales are defined. */
|
|
15
15
|
export const BuiltInDefaultLocale = { ...getLocaleInfo('en'), lang: 'en' };
|
|
16
16
|
|
|
17
17
|
/**
|
|
@@ -135,7 +135,7 @@ function getStarlightI18nConfig(
|
|
|
135
135
|
};
|
|
136
136
|
}
|
|
137
137
|
|
|
138
|
-
/** Infer Starlight locale
|
|
138
|
+
/** Infer Starlight locale information based on a locale from an Astro i18n configuration. */
|
|
139
139
|
function inferStarlightLocaleFromAstroLocale(astroLocale: AstroLocale) {
|
|
140
140
|
const lang = isAstroLocaleExtendedConfig(astroLocale) ? astroLocale.codes[0] : astroLocale;
|
|
141
141
|
return { ...getLocaleInfo(lang), lang };
|
|
@@ -159,7 +159,7 @@ function isAstroLocaleExtendedConfig(locale: AstroLocale): locale is AstroLocale
|
|
|
159
159
|
return typeof locale !== 'string';
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
-
/** Returns the locale
|
|
162
|
+
/** Returns the locale information such as a label and a direction based on a BCP-47 tag. */
|
|
163
163
|
function getLocaleInfo(lang: string) {
|
|
164
164
|
try {
|
|
165
165
|
const locale = new Intl.Locale(lang);
|
|
@@ -171,7 +171,7 @@ function getLocaleInfo(lang: string) {
|
|
|
171
171
|
};
|
|
172
172
|
} catch {
|
|
173
173
|
throw new AstroError(
|
|
174
|
-
`Failed to get locale
|
|
174
|
+
`Failed to get locale information for the '${lang}' locale.`,
|
|
175
175
|
'Make sure to provide a valid BCP-47 tags (e.g. en, ar, or zh-CN).'
|
|
176
176
|
);
|
|
177
177
|
}
|
package/utils/starlight-page.ts
CHANGED
|
@@ -44,7 +44,7 @@ const StarlightPageFrontmatterSchema = async (context: SchemaContext) => {
|
|
|
44
44
|
* `pick`.
|
|
45
45
|
*
|
|
46
46
|
* This transformer only sets the `editUrl` default value and removes the `sidebar` property
|
|
47
|
-
* from the validated output but does not
|
|
47
|
+
* from the validated output but does not apply any changes to the input schema type itself so
|
|
48
48
|
* this needs to be done manually.
|
|
49
49
|
*
|
|
50
50
|
* @see StarlightPageFrontmatter
|
package/utils/user-config.ts
CHANGED
|
@@ -163,7 +163,24 @@ const UserConfigSchema = z.object({
|
|
|
163
163
|
* customCss: ['/src/custom-styles.css', '@fontsource/roboto'],
|
|
164
164
|
* })
|
|
165
165
|
*/
|
|
166
|
-
customCss: z
|
|
166
|
+
customCss: z
|
|
167
|
+
.string()
|
|
168
|
+
.array()
|
|
169
|
+
.optional()
|
|
170
|
+
.default([])
|
|
171
|
+
.superRefine((paths, ctx) => {
|
|
172
|
+
const invalidPathRegex = /^\.?\/public\/.+$/;
|
|
173
|
+
const invalidPaths = paths.filter((path) => invalidPathRegex.test(path));
|
|
174
|
+
if (invalidPaths.length > 0) {
|
|
175
|
+
ctx.addIssue({
|
|
176
|
+
code: 'custom',
|
|
177
|
+
message:
|
|
178
|
+
`These paths in your Starlight \`customCss\` config are invalid: ${invalidPaths.map((path) => `\`"${path}"\``).join(', ')}\n\n` +
|
|
179
|
+
`CSS files specified in \`customCss\` should be in the \`src/\` directory, not the \`public/\` directory.\n\n` +
|
|
180
|
+
`You should move these CSS files into the \`src/\` directory and update the path in \`customCss\` to match.`,
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
}),
|
|
167
184
|
|
|
168
185
|
/** Define if the last update date should be visible in the page footer. */
|
|
169
186
|
lastUpdated: z
|