@astrojs/starlight 0.35.3 → 0.36.1
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 +66 -0
- package/components/Icons.ts +1 -1
- package/components/SidebarSublist.astro +1 -1
- package/package.json +1 -1
- package/schema.ts +1 -1
- package/schemas/head.ts +40 -9
- package/style/markdown.css +9 -1
- package/style/props.css +1 -0
- package/translations/gl.json +25 -12
- package/user-components/Tabs.astro +3 -1
- package/utils/head.ts +6 -3
- package/utils/user-config.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,71 @@
|
|
|
1
1
|
# @astrojs/starlight
|
|
2
2
|
|
|
3
|
+
## 0.36.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#3479](https://github.com/withastro/starlight/pull/3479) [`2fec483`](https://github.com/withastro/starlight/commit/2fec4833d4867db35b77079ce3026b79ba1e0441) Thanks [@gboubeta-uvigo](https://github.com/gboubeta-uvigo)! - Updates Galician UI translations
|
|
8
|
+
|
|
9
|
+
- [#3457](https://github.com/withastro/starlight/pull/3457) [`c6c0c51`](https://github.com/withastro/starlight/commit/c6c0c5114a659b22ffcc4c2085ad8c1fc4f43a5d) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Deduplicates sitemap link tags in the head.
|
|
10
|
+
|
|
11
|
+
When [enabling sitemap](https://starlight.astro.build/guides/customization/#enable-sitemap) in Starlight, a `<link rel="sitemap" href="/sitemap-index.xml">` tag is automatically added to the head of each page. Manually specifying sitemap link tags using the Starlight [`head` configuration option](https://starlight.astro.build/reference/configuration/#head) or the [`head` frontmatter field](https://starlight.astro.build/reference/frontmatter/#head) will now override the default sitemap link tag added by Starlight.
|
|
12
|
+
|
|
13
|
+
This change ensures that users manually adding the `@astrojs/sitemap` integration to the Astro `integrations` array for more fine-grained control over sitemap generation and also using the [`filenameBase` integration option](https://docs.astro.build/en/guides/integrations-guide/sitemap/#filenamebase) can customize the sitemap link tag in the head.
|
|
14
|
+
|
|
15
|
+
- [#3448](https://github.com/withastro/starlight/pull/3448) [`1fc7501`](https://github.com/withastro/starlight/commit/1fc7501d16218c7f156c5e90df25ae6fbb8abfea) Thanks [@dionysuzx](https://github.com/dionysuzx)! - Enlarges the Farcaster icon to better match other social icons
|
|
16
|
+
|
|
17
|
+
- [#3473](https://github.com/withastro/starlight/pull/3473) [`07204dd`](https://github.com/withastro/starlight/commit/07204dd7b8b6ee71bf24ff9c7d70fc7306bf2076) Thanks [@gboubeta](https://github.com/gboubeta)! - Fixes a typo in Galician table of contents label
|
|
18
|
+
|
|
19
|
+
## 0.36.0
|
|
20
|
+
|
|
21
|
+
### Minor Changes
|
|
22
|
+
|
|
23
|
+
- [#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
|
|
24
|
+
|
|
25
|
+
⚠️ **Potentially breaking change:** Tab labels now have a narrower line-height and additional vertical padding. If you have custom CSS targetting the `<Tabs>` component, you may want to double check the visual appearance of your tabs when updating.
|
|
26
|
+
|
|
27
|
+
If you want to preserve the previous styling, you can add the following custom CSS to your site:
|
|
28
|
+
|
|
29
|
+
```css
|
|
30
|
+
.tab > [role='tab'] {
|
|
31
|
+
line-height: var(--sl-line-height);
|
|
32
|
+
padding-block: 0;
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
- [#3380](https://github.com/withastro/starlight/pull/3380) [`3364af3`](https://github.com/withastro/starlight/commit/3364af31e535d62ee7b045e6d9cf97c7e58df981) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Makes head entry parsing stricter in Starlight config and content frontmatter.
|
|
37
|
+
|
|
38
|
+
**⚠️ Potentially breaking change:** Previously Starlight would accept a head entry for a `meta` tag defining some `content` which generates invalid HTML as `<meta>` is a void element which cannot have any child nodes. Now, it is an error to define a `meta` tag including some `content`.
|
|
39
|
+
|
|
40
|
+
If you see errors after updating, look for head entries in the Starlight configuration in the `astro.config.mjs` file or in the frontmatter of your content files that include a `content` property for a `meta` tag. To fix the error, move the `content` property to the `attrs` object with at least an additional attribute to identify the kind of metadata it represents:
|
|
41
|
+
|
|
42
|
+
```diff
|
|
43
|
+
head: {
|
|
44
|
+
tag: 'meta',
|
|
45
|
+
- content: 'foo',
|
|
46
|
+
attrs: {
|
|
47
|
+
name: 'my-meta',
|
|
48
|
+
+ content: 'foo',
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
- [#3340](https://github.com/withastro/starlight/pull/3340) [`2018c31`](https://github.com/withastro/starlight/commit/2018c31b0f559d51478bfbf9f12cfba76b4e74fc) Thanks [@HiDeoo](https://github.com/HiDeoo)! - Adds missing vertical spacing between Markdown content and UI Framework components using [client directives](https://docs.astro.build/en/reference/directives-reference/#client-directives).
|
|
54
|
+
|
|
55
|
+
**⚠️ Potentially breaking change:** By default, Starlight applies some vertical spacing (`--sl-content-gap-y`) between Markdown content blocks. This change introduces similar spacing between Markdown content blocks and UI Framework components using client directives which was not present before.
|
|
56
|
+
|
|
57
|
+
If you were relying on the previous behavior, you can manually override the spacing by manually specifying the top margin on the component using [custom CSS](https://starlight.astro.build/guides/css-and-tailwind/#custom-css-styles), e.g. by relying on a CSS class to target the component.
|
|
58
|
+
|
|
59
|
+
```css
|
|
60
|
+
.my-custom-component {
|
|
61
|
+
margin-top: 0;
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Patch Changes
|
|
66
|
+
|
|
67
|
+
- [#3423](https://github.com/withastro/starlight/pull/3423) [`a0d0670`](https://github.com/withastro/starlight/commit/a0d0670bce5827b90fd0102fa3517814367760e7) Thanks [@andersk](https://github.com/andersk)! - Fixes HTML validity in sidebar groups by ensuring `<summary>` is the first child of `<details>`
|
|
68
|
+
|
|
3
69
|
## 0.35.3
|
|
4
70
|
|
|
5
71
|
### Patch Changes
|
package/components/Icons.ts
CHANGED
|
@@ -81,7 +81,7 @@ export const BuiltInIcons = {
|
|
|
81
81
|
codePen:
|
|
82
82
|
'<path d="M23.5 7.5 12.5.2a1 1 0 0 0-1 0L.4 7.5a1 1 0 0 0-.5.8v7.4c0 .3.2.6.5.8l11 7.3c.3.3.7.3 1 0l11-7.3c.3-.2.5-.5.5-.8V8.3a1 1 0 0 0-.5-.8zM13 3l8.1 5.3-3.6 2.5-4.5-3V3zm-2 0v4.8l-4.5 3-3.6-2.5 8-5.3zm-9 7.3L4.7 12l-2.5 1.7v-3.4zM11 21l-8.1-5.3 3.6-2.5 4.5 3V21zm1-6.6L8.4 12 12 9.6l3.6 2.4-3.6 2.4zm1 6.6v-4.8l4.5-3 3.6 2.5-8 5.3zm9-7.3L19.3 12l2.5-1.7v3.4z"/>',
|
|
83
83
|
farcaster:
|
|
84
|
-
'<path d="
|
|
84
|
+
'<path d="M 4.572 1.25 h 14.59 v 20.746 h -2.142 v -9.503 h -0.021 a 5.154 5.154 0 0 0 -10.264 0 h -0.021 v 9.503 H 4.571 z"/><path d="m 0.69 4.195 0.87 2.945 h 0.737 v 11.912 a 0.669 0.669 0 0 0 -0.669 0.669 v 0.803 h -0.134 a 0.669 0.669 0 0 0 -0.669 0.669 v 0.803 h 7.495 v -0.803 a 0.669 0.669 0 0 0 -0.669 -0.669 h -0.134 v -0.803 A 0.669 0.669 0 0 0 6.847 19.052 h -0.803 V 4.195 z M 17.153 19.052 a 0.669 0.669 0 0 0 -0.669 0.669 v 0.803 h -0.134 a 0.669 0.669 0 0 0 -0.669 0.669 v 0.803 h 7.495 v -0.803 a 0.669 0.669 0 0 0 -0.669 -0.669 h -0.134 v -0.803 a 0.669 0.669 0 0 0 -0.669 -0.669 V 7.14 h 0.737 l 0.87 -2.945 h -5.354 v 14.857 z"/>',
|
|
85
85
|
discord:
|
|
86
86
|
'<path d="M20.32 4.37a19.8 19.8 0 0 0-4.93-1.51 13.78 13.78 0 0 0-.64 1.28 18.27 18.27 0 0 0-5.5 0 12.64 12.64 0 0 0-.64-1.28h-.05A19.74 19.74 0 0 0 3.64 4.4 20.26 20.26 0 0 0 .11 18.09l.02.02a19.9 19.9 0 0 0 6.04 3.03l.04-.02a14.24 14.24 0 0 0 1.23-2.03.08.08 0 0 0-.05-.07 13.1 13.1 0 0 1-1.9-.92.08.08 0 0 1 .02-.1 10.2 10.2 0 0 0 .41-.31h.04a14.2 14.2 0 0 0 12.1 0l.04.01a9.63 9.63 0 0 0 .4.32.08.08 0 0 1-.03.1 12.29 12.29 0 0 1-1.9.91.08.08 0 0 0-.02.1 15.97 15.97 0 0 0 1.27 2.01h.04a19.84 19.84 0 0 0 6.03-3.05v-.03a20.12 20.12 0 0 0-3.57-13.69ZM8.02 15.33c-1.18 0-2.16-1.08-2.16-2.42 0-1.33.96-2.42 2.16-2.42 1.21 0 2.18 1.1 2.16 2.42 0 1.34-.96 2.42-2.16 2.42Zm7.97 0c-1.18 0-2.15-1.08-2.15-2.42 0-1.33.95-2.42 2.15-2.42 1.22 0 2.18 1.1 2.16 2.42 0 1.34-.94 2.42-2.16 2.42Z"/>',
|
|
87
87
|
gitter:
|
|
@@ -37,7 +37,6 @@ const { sublist, nested } = Astro.props;
|
|
|
37
37
|
<details
|
|
38
38
|
open={flattenSidebar(entry.entries).some((i) => i.isCurrent) || !entry.collapsed}
|
|
39
39
|
>
|
|
40
|
-
<SidebarRestorePoint />
|
|
41
40
|
<summary>
|
|
42
41
|
<span class="group-label">
|
|
43
42
|
<span class="large">{entry.label}</span>
|
|
@@ -51,6 +50,7 @@ const { sublist, nested } = Astro.props;
|
|
|
51
50
|
</span>
|
|
52
51
|
<Icon name="right-caret" class="caret" size="1.25rem" />
|
|
53
52
|
</summary>
|
|
53
|
+
<SidebarRestorePoint />
|
|
54
54
|
<Astro.self sublist={entry.entries} nested />
|
|
55
55
|
</details>
|
|
56
56
|
)}
|
package/package.json
CHANGED
package/schema.ts
CHANGED
|
@@ -30,7 +30,7 @@ const StarlightFrontmatterSchema = (context: SchemaContext) =>
|
|
|
30
30
|
editUrl: z.union([z.string().url(), z.boolean()]).optional().default(true),
|
|
31
31
|
|
|
32
32
|
/** Set custom `<head>` tags just for this page. */
|
|
33
|
-
head: HeadConfigSchema(),
|
|
33
|
+
head: HeadConfigSchema({ source: 'content' }),
|
|
34
34
|
|
|
35
35
|
/** Override global table of contents configuration for this page. */
|
|
36
36
|
tableOfContents: TableOfContentsSchema().optional(),
|
package/schemas/head.ts
CHANGED
|
@@ -1,16 +1,47 @@
|
|
|
1
1
|
import { z } from 'astro/zod';
|
|
2
|
+
import yaml from 'js-yaml';
|
|
2
3
|
|
|
3
|
-
export const HeadConfigSchema = (
|
|
4
|
+
export const HeadConfigSchema = ({
|
|
5
|
+
source,
|
|
6
|
+
}: {
|
|
7
|
+
/**
|
|
8
|
+
* Depending on the content being validated, either a user's config or a page's frontmatter,
|
|
9
|
+
* different error messages will be shown.
|
|
10
|
+
*/
|
|
11
|
+
source: 'config' | 'content';
|
|
12
|
+
}) =>
|
|
4
13
|
z
|
|
5
14
|
.array(
|
|
6
|
-
z
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
15
|
+
z
|
|
16
|
+
.object({
|
|
17
|
+
/** Name of the HTML tag to add to `<head>`, e.g. `'meta'`, `'link'`, or `'script'`. */
|
|
18
|
+
tag: z.enum(['title', 'base', 'link', 'style', 'meta', 'script', 'noscript', 'template']),
|
|
19
|
+
/** Attributes to set on the tag, e.g. `{ rel: 'stylesheet', href: '/custom.css' }`. */
|
|
20
|
+
attrs: z.record(z.union([z.string(), z.boolean(), z.undefined()])).optional(),
|
|
21
|
+
/** Content to place inside the tag (optional). */
|
|
22
|
+
content: z.string().optional(),
|
|
23
|
+
})
|
|
24
|
+
.superRefine((config, ctx) => {
|
|
25
|
+
if (config.tag !== 'meta' || config.content === undefined) return;
|
|
26
|
+
const { content, ...rest } = config;
|
|
27
|
+
const correctTag = {
|
|
28
|
+
...rest,
|
|
29
|
+
attrs: { ...(config.attrs ?? { name: 'identifier' }), content: config.content },
|
|
30
|
+
};
|
|
31
|
+
const code =
|
|
32
|
+
source === 'config' ? JSON.stringify(correctTag, null, 2) : yaml.dump([correctTag]);
|
|
33
|
+
ctx.addIssue({
|
|
34
|
+
code: 'custom',
|
|
35
|
+
message:
|
|
36
|
+
`The \`head\` configuration includes a \`meta\` tag with \`content\` which is invalid HTML.\n` +
|
|
37
|
+
`You should instead use a \`content\` attribute ` +
|
|
38
|
+
(Object.keys(rest.attrs ?? {}).length === 0
|
|
39
|
+
? 'with an additional attribute such as `name`, `property`, or `http-equiv` to identify the kind of metadata it represents '
|
|
40
|
+
: '') +
|
|
41
|
+
`in the \`attrs\` object:\n\n` +
|
|
42
|
+
code,
|
|
43
|
+
});
|
|
44
|
+
})
|
|
14
45
|
)
|
|
15
46
|
.default([]);
|
|
16
47
|
|
package/style/markdown.css
CHANGED
|
@@ -2,7 +2,15 @@
|
|
|
2
2
|
.sl-markdown-content
|
|
3
3
|
:not(a, strong, em, del, span, input, code, br)
|
|
4
4
|
+ :not(a, strong, em, del, span, input, code, br, :where(.not-content *)) {
|
|
5
|
-
margin-top:
|
|
5
|
+
margin-top: var(--sl-content-gap-y);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/* Vertical spacing between Markdown content blocks and UI Framework components using client directives. */
|
|
9
|
+
.sl-markdown-content
|
|
10
|
+
:not(a, strong, em, del, span, input, code, br)
|
|
11
|
+
+ :is(astro-island, astro-slot)
|
|
12
|
+
> :not(a, strong, em, del, span, input, code, br, :where(.not-content *)):first-child {
|
|
13
|
+
margin-top: var(--sl-content-gap-y);
|
|
6
14
|
}
|
|
7
15
|
|
|
8
16
|
/* Headings after non-headings have more spacing. */
|
package/style/props.css
CHANGED
package/translations/gl.json
CHANGED
|
@@ -4,27 +4,40 @@
|
|
|
4
4
|
"search.ctrlKey": "Ctrl",
|
|
5
5
|
"search.cancelLabel": "Deixar",
|
|
6
6
|
"search.devWarning": "A busca só está dispoñible nas versións de producción. \nTrata de construir e ollear o sitio para probalo localmente.",
|
|
7
|
-
"themeSelect.accessibleLabel": "
|
|
7
|
+
"themeSelect.accessibleLabel": "Selecciona tema",
|
|
8
8
|
"themeSelect.dark": "Escuro",
|
|
9
9
|
"themeSelect.light": "Claro",
|
|
10
10
|
"themeSelect.auto": "Auto",
|
|
11
11
|
"languageSelect.accessibleLabel": "Seleciona linguaxe",
|
|
12
12
|
"menuButton.accessibleLabel": "Menú",
|
|
13
13
|
"sidebarNav.accessibleLabel": "Principal",
|
|
14
|
-
"tableOfContents.onThisPage": "Nesta
|
|
14
|
+
"tableOfContents.onThisPage": "Nesta páxina",
|
|
15
15
|
"tableOfContents.overview": "Sinopse",
|
|
16
16
|
"i18n.untranslatedContent": "Este contido aínda non está dispoñible no teu idioma.",
|
|
17
|
-
"page.editLink": "Editar
|
|
17
|
+
"page.editLink": "Editar páxina",
|
|
18
18
|
"page.lastUpdated": "Última actualización:",
|
|
19
19
|
"page.previousLink": "Anterior",
|
|
20
20
|
"page.nextLink": "Seguinte",
|
|
21
|
-
"page.draft": "
|
|
22
|
-
"404.text": "
|
|
23
|
-
"aside.note": "
|
|
24
|
-
"aside.tip": "
|
|
25
|
-
"aside.caution": "
|
|
26
|
-
"aside.danger": "
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
21
|
+
"page.draft": "Este contido é un borrador e non se incluirá nas versións de producción.",
|
|
22
|
+
"404.text": "Páxina non atopada. Comproba a URL ou intenta usar a barra de busca.",
|
|
23
|
+
"aside.note": "Nota",
|
|
24
|
+
"aside.tip": "Consello",
|
|
25
|
+
"aside.caution": "Precaución",
|
|
26
|
+
"aside.danger": "Perigo",
|
|
27
|
+
"expressiveCode.copyButtonCopied": "¡Copiado!",
|
|
28
|
+
"expressiveCode.copyButtonTooltip": "Copiar ao portapapeis",
|
|
29
|
+
"expressiveCode.terminalWindowFallbackTitle": "Fiestra do terminal",
|
|
30
|
+
"fileTree.directory": "Directorio",
|
|
31
|
+
"builtWithStarlight.label": "Feito con Starlight",
|
|
32
|
+
"pagefind.clear_search": "Limpar",
|
|
33
|
+
"pagefind.load_more": "Cargar máis resultados",
|
|
34
|
+
"pagefind.search_label": "Buscar páxina",
|
|
35
|
+
"pagefind.filters_label": "Filtros",
|
|
36
|
+
"pagefind.zero_results": "Ningún resultado para: [SEARCH_TERM]",
|
|
37
|
+
"pagefind.many_results": "[COUNT] resultados para: [SEARCH_TERM]",
|
|
38
|
+
"pagefind.one_result": "[COUNT] resultado para: [SEARCH_TERM]",
|
|
39
|
+
"pagefind.alt_search": "Ningún resultado para [SEARCH_TERM]. Amósanse resultados para: [DIFFERENT_TERM]",
|
|
40
|
+
"pagefind.search_suggestion": "Ningún resultado para [SEARCH_TERM]. Proba algunha destas buscas:",
|
|
41
|
+
"pagefind.searching": "Buscando [SEARCH_TERM]...",
|
|
42
|
+
"heading.anchorLabel": "Sección titulada «{{title}}»"
|
|
30
43
|
}
|
|
@@ -115,13 +115,15 @@ if (isSynced) {
|
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
.tab {
|
|
118
|
+
display: flex;
|
|
118
119
|
margin-bottom: -2px;
|
|
119
120
|
}
|
|
120
121
|
.tab > [role='tab'] {
|
|
121
122
|
display: flex;
|
|
122
123
|
align-items: center;
|
|
123
124
|
gap: 0.5rem;
|
|
124
|
-
|
|
125
|
+
line-height: var(--sl-line-height-headings);
|
|
126
|
+
padding: 0.275rem 1.25rem;
|
|
125
127
|
text-decoration: none;
|
|
126
128
|
border-bottom: 2px solid var(--sl-color-gray-5);
|
|
127
129
|
color: var(--sl-color-gray-3);
|
package/utils/head.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { fileWithBase } from './base';
|
|
|
7
7
|
import { formatCanonical } from './canonical';
|
|
8
8
|
import { localizedUrl } from './localizedUrl';
|
|
9
9
|
|
|
10
|
-
const HeadSchema = HeadConfigSchema();
|
|
10
|
+
const HeadSchema = HeadConfigSchema({ source: 'content' });
|
|
11
11
|
|
|
12
12
|
/** Get the head for the current page. */
|
|
13
13
|
export function getHead(
|
|
@@ -120,7 +120,8 @@ function createHead(defaults: HeadUserConfig, ...heads: HeadConfig[]) {
|
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
/**
|
|
123
|
-
* Test if a head config object contains a matching `<title
|
|
123
|
+
* Test if a head config object contains a matching `<title>`, `<meta>`, `<link rel="canonical">`
|
|
124
|
+
* or `<link rel="sitemap">` tag.
|
|
124
125
|
*
|
|
125
126
|
* For example, will return true if `head` already contains
|
|
126
127
|
* `<meta name="description" content="A">` and the passed `tag`
|
|
@@ -135,7 +136,9 @@ function hasTag(head: HeadConfig, entry: HeadConfig[number]): boolean {
|
|
|
135
136
|
return hasOneOf(head, entry, ['name', 'property', 'http-equiv']);
|
|
136
137
|
case 'link':
|
|
137
138
|
return head.some(
|
|
138
|
-
({ attrs }) =>
|
|
139
|
+
({ attrs }) =>
|
|
140
|
+
(entry.attrs?.rel === 'canonical' && attrs?.rel === 'canonical') ||
|
|
141
|
+
(entry.attrs?.rel === 'sitemap' && attrs?.rel === 'sitemap')
|
|
139
142
|
);
|
|
140
143
|
default:
|
|
141
144
|
return false;
|
package/utils/user-config.ts
CHANGED