Releases: withastro/starlight
@astrojs/[email protected]
Minor Changes
-
#3026
82deb84
Thanks @HiDeoo! - Fixes a potential list styling issue if the last element of a list item is a<script>
tag.⚠️ BREAKING CHANGE:This release drops official support for Chromium-based browsers prior to version 105 (released 30 August 2022) and Firefox-based browsers prior to version 121 (released 19 December 2023). You can find a list of currently supported browsers and their versions using this browserslist query.
With this release, Starlight-generated sites will still work fine on those older browsers except for this small detail in list item styling, but future releases may introduce further breaking changes for impacted browsers, including in patch releases.
-
#3025
f87e9ac
Thanks @delucis! - Makessocial
configuration more flexible.⚠️ BREAKING CHANGE: Thesocial
configuration option has changed syntax. You will need to update this inastro.config.mjs
when upgrading.Previously, a limited set of platforms were supported using a shorthand syntax with labels built in to Starlight. While convenient, this approach was less flexible and required dedicated code for each social platform added.
Now, you must specify the icon and label for each social link explicitly and you can use any of Starlight’s built-in icons for social links.
The following example shows updating the old
social
syntax to the new:- social: { - github: 'https://github.com/withastro/starlight', - discord: 'https://astro.build/chat', - }, + social: [ + { icon: 'github', label: 'GitHub', href: 'https://github.com/withastro/starlight' }, + { icon: 'discord', label: 'Discord', href: 'https://astro.build/chat' }, + ],
-
#2927
c46904c
Thanks @HiDeoo! - Adds thehead
route data property which contains an array of all tags to include in the<head>
of the current page.Previously, the
<Head>
component was responsible for generating a list of tags to include in the<head>
of the current page and rendering them.
This data is now available asAstro.locals.starlightRoute.head
instead and can be modified using route data middleware.
The<Head>
component now only renders the tags provided inAstro.locals.starlightRoute.head
. -
#2924
6a56d1b
Thanks @HiDeoo! -⚠️ BREAKING CHANGE: Ensures that the<Badge>
and<Icon>
components no longer render with a trailing space.In Astro, components that include styles render with a trailing space which can prevent some use cases from working as expected, e.g. when using such components inlined with text. This change ensures that the
<Badge>
and<Icon>
components no longer render with a trailing space.If you were previously relying on that implementation detail, you may need to update your code to account for this change. For example, considering the following code:
<Badge text="New" /> Feature
The rendered text would previously include a space between the badge and the text due to the trailing space automatically added by the component:
New Feature
Such code will now render the badge and text without a space:
NewFeature
To fix this, you can add a space between the badge and the text:
- <Badge text="New" />Feature + <Badge text="New" /> Feature
-
#2727
7c8fa30
Thanks @techfg! - Updates mobile menu toggle styles to display a close icon while the menu is open
Patch Changes
-
#2927
c46904c
Thanks @HiDeoo! - Fixes an issue where overriding the canonical URL of a page using thehead
configuration option orhead
frontmatter field would strip any other<link>
tags from the<head>
. -
#2927
c46904c
Thanks @HiDeoo! - Fixes an issue where generated canonical URLs would include a trailing slash when using thetrailingSlash
Astro option is set to'never'
. -
#3025
f87e9ac
Thanks @delucis! - Fixes Starlight’s autogenerated<meta name="twitter:site">
tags when a Twitter link is set insocial
config. Previously these incorrectly renderedcontent="/username"
and now correctly rendercontent="@username"
.
@astrojs/[email protected]
Patch Changes
-
#3030
5bdf139
Thanks @trueberryless! - Updates the type of theisFallback
field in route data fromtrue
toboolean
, keeping it optional but allowingfalse
as a possible value. -
#3018
188b8cf
Thanks @trueberryless! - Adds validation for user configrouteMiddleware
so it does not conflict with Astro's middleware.
@astrojs/[email protected]
Patch Changes
-
#3021
e3f881e
Thanks @jsparkdev! - Updates Korean language support -
#3013
5b599dd
Thanks @oluwatobiss! - Adds Substack icon to social links list
@astrojs/[email protected]
@astrojs/[email protected]
Patch Changes
- #2991
b8a4800
Thanks @florian-lefebvre! - Adds support for@astrojs/tailwind
v6
@astrojs/[email protected]
Patch Changes
-
#2955
77b6a41
Thanks @trueberryless! - Adds 5 new icons:figma
,sketch
,vim
,vscode
, andzed
. -
#2961
da57fab
Thanks @ematipico! - Adds 1 new icon:jetbrains
.
@astrojs/[email protected]
Minor Changes
-
#2931
10b93b3
Thanks @HiDeoo! - Adds support for thetitle
,frame
, andmeta
fence attributes to code blocks.These new optional attributes add support for Expressive Code text & line markers. The following example renders a code block using a terminal frame with a title:
```js {% title="editor.exe" frame="terminal" %} console.log('Hello, world!'); ```
Any other text or line markers should be specified using the
meta
fence attribute. For example, the following code block renders a code block using thediff
syntax combined with thejs
language syntax highlighting and themarkers
text highlighted:```diff {% meta="lang=js 'markers'" %} function thisIsJavaScript() { // This entire block gets highlighted as JavaScript, // and we can still add diff markers to it! - console.log('Old code to be removed') + console.log('New and shiny code!') } ```
To learn more about all the available options, check out the Expressive Code documentation.
@astrojs/[email protected]
Patch Changes
-
#2926
c0170fd
Thanks @resoltico! - Adds Latvian language support -
#2918
790c000
Thanks @HiDeoo! - Fixes a trailing slash inconsistency in generated sidebar links when using thetrailingSlash: 'ignore'
Astro option (the default) between internal and auto-generated links. Starlight behavior for this configuration value is to use a trailing slash as many common hosting providers redirect to URLs with a trailing slash by default.
@astrojs/[email protected]
@astrojs/[email protected]
Minor Changes
-
#2390
f493361
Thanks @delucis! - Moves route data toAstro.locals
instead of passing it down via component props⚠️ Breaking change:
Previously, all of Starlight’s templating components, including user or plugin overrides, had access to a data object for the current route viaAstro.props
.
This data is now available asAstro.locals.starlightRoute
instead.To update, refactor any component overrides you have:
- Remove imports of
@astrojs/starlight/props
, which is now deprecated. - Update code that accesses
Astro.props
to useAstro.locals.starlightRoute
instead. - Remove any spreading of
{...Astro.props}
into child components, which is no longer required.
In the following example, a custom override for Starlight’s
LastUpdated
component is updated for the new style:--- import Default from '@astrojs/starlight/components/LastUpdated.astro'; - import type { Props } from '@astrojs/starlight/props'; - const { lastUpdated } = Astro.props; + const { lastUpdated } = Astro.locals.starlightRoute; const updatedThisYear = lastUpdated?.getFullYear() === new Date().getFullYear(); --- {updatedThisYear && ( - <Default {...Astro.props}><slot /></Default> + <Default><slot /></Default> )}
Community Starlight plugins may also need to be manually updated to work with Starlight 0.32. If you encounter any issues, please reach out to the plugin author to see if it is a known issue or if an updated version is being worked on.
- Remove imports of
-
#2578
f895f75
Thanks @HiDeoo! - Deprecates the Starlight pluginsetup
hook in favor of the newconfig:setup
hook which provides the same functionality.⚠️ BREAKING CHANGE:The Starlight plugin
setup
hook is now deprecated and will be removed in a future release. Please update your plugins to use the newconfig:setup
hook instead.export default { name: 'plugin-with-translations', hooks: { - 'setup'({ config }) { + 'config:setup'({ config }) { // Your plugin configuration setup code }, }, };
-
#2578
f895f75
Thanks @HiDeoo! - Exposes the built-in localization system in the Starlight pluginconfig:setup
hook.⚠️ BREAKING CHANGE:This addition changes how Starlight plugins add or update translation strings used in Starlight’s localization APIs.
Plugins previously using theinjectTranslations()
callback function from the pluginconfig:setup
hook should now use the same function available in thei18n:setup
hook.export default { name: 'plugin-with-translations', hooks: { - 'config:setup'({ injectTranslations }) { + 'i18n:setup'({ injectTranslations }) { injectTranslations({ en: { 'myPlugin.doThing': 'Do the thing', }, fr: { 'myPlugin.doThing': 'Faire le truc', }, }); }, }, };
-
#2858
2df9d05
Thanks @XREvo! - Adds support for Pagefind’s multisite search features -
#2578
f895f75
Thanks @HiDeoo! - Adds a newHookParameters
utility type to get the type of a plugin hook’s arguments. -
#2578
f895f75
Thanks @HiDeoo! - Adds a newuseTranslations()
callback function to the Starlight pluginconfig:setup
hook to generate a utility function to access UI strings for a given language. -
#2578
f895f75
Thanks @HiDeoo! - Adds a newabsolutePathToLang()
callback function to the Starlight pluginconfig:setup
to get the language for a given absolute file path.