diff --git a/src/content/docs/en/guides/integrations-guide/markdoc.mdx b/src/content/docs/en/guides/integrations-guide/markdoc.mdx index 6d50379e77cb2..665b086fa971a 100644 --- a/src/content/docs/en/guides/integrations-guide/markdoc.mdx +++ b/src/content/docs/en/guides/integrations-guide/markdoc.mdx @@ -211,7 +211,7 @@ For example, the heading `### Level 3 heading!` will pass `level: 3` and `id: 'l ### Syntax highlighting -`@astrojs/markdoc` provides [Shiki](https://github.com/shikijs/shiki) and [Prism](https://github.com/PrismJS) extensions to highlight your code blocks. +`@astrojs/markdoc` provides [Shiki](https://shiki.style) and [Prism](https://github.com/PrismJS) extensions to highlight your code blocks. #### Shiki @@ -226,14 +226,14 @@ export default defineMarkdocConfig({ shiki({ // Choose from Shiki's built-in themes (or add your own) // Default: 'github-dark' - // https://github.com/shikijs/shiki/blob/main/docs/themes.md + // https://shiki.style/themes theme: 'dracula', // Enable word wrap to prevent horizontal scrolling // Default: false wrap: true, // Pass custom languages // Note: Shiki has countless langs built-in, including `.astro`! - // https://github.com/shikijs/shiki/blob/main/docs/languages.md + // https://shiki.style/languages langs: [], }), ], diff --git a/src/content/docs/en/guides/markdown-content.mdx b/src/content/docs/en/guides/markdown-content.mdx index b9da39cb7618e..abdb5d9bfaeeb 100644 --- a/src/content/docs/en/guides/markdown-content.mdx +++ b/src/content/docs/en/guides/markdown-content.mdx @@ -572,7 +572,7 @@ export default defineConfig({ ### Syntax Highlighting -Astro comes with built-in support for [Shiki](https://shiki.matsu.io/) (via [Shikiji](https://github.com/shikijs/shiki)) and [Prism](https://prismjs.com/). This provides syntax highlighting for: +Astro comes with built-in support for [Shiki](https://shiki.style/) and [Prism](https://prismjs.com/). This provides syntax highlighting for: - all code fences (\`\`\`) used in a Markdown or MDX file. - content within the [built-in `` component](/en/reference/api-reference/#code-) (powered by Shiki). @@ -591,17 +591,17 @@ export default defineConfig({ markdown: { shikiConfig: { // Choose from Shiki's built-in themes (or add your own) - // https://github.com/shikijs/shiki/blob/main/docs/themes.md + // https://shiki.style/themes theme: 'dracula', // Alternatively, provide multiple themes - // https://shiki.style/guide/dual-themes#light-dark-dual-themes - experimentalThemes: { + // https://shiki.style/guide/dual-themes + themes: { light: 'github-light', dark: 'github-dark', }, // Add custom languages // Note: Shiki has countless langs built-in, including .astro! - // https://github.com/shikijs/shiki/blob/main/docs/languages.md + // https://shiki.style/languages langs: [], // Enable word wrap to prevent horizontal scrolling wrap: true, @@ -628,7 +628,7 @@ export default defineConfig({ }); ``` -We also suggest reading [Shiki's own theme documentation](https://github.com/shikijs/shiki/blob/main/docs/themes.md#loading-theme) to explore more about themes, light vs dark mode toggles, or styling via CSS variables. +We also suggest reading [Shiki's own theme documentation](https://shiki.style/themes) to explore more about themes, light vs dark mode toggles, or styling via CSS variables. #### Change Default Syntax Highlighting Mode diff --git a/src/content/docs/en/guides/middleware.mdx b/src/content/docs/en/guides/middleware.mdx index 32276412b155f..dbee71d647f1b 100644 --- a/src/content/docs/en/guides/middleware.mdx +++ b/src/content/docs/en/guides/middleware.mdx @@ -5,17 +5,9 @@ i18nReady: true --- import PackageManagerTabs from '~/components/tabs/PackageManagerTabs.astro'; -**Middleware** allows you to intercept requests and responses and inject behaviors dynamically every time a page or endpoint is about to be rendered. +**Middleware** allows you to intercept requests and responses and inject behaviors dynamically every time a page or endpoint is about to be rendered. This rendering occurs at build time for all prerendered pages, but occurs when the route is requested for pages rendered on demand. -This also allows you to set and share request-specific information across endpoints and pages by mutating a `locals` object that is available in all Astro components and API endpoints - -Middleware is available in both SSG and SSR Astro projects. - -:::note -On all prerendered pages, the middleware runs only during the **build process** to create static pages and does not run in the deployed website. This applies to all pages in a `static` (SSG) project. This also includes prerendered pages in `hybrid` mode (default) and any pages in `server` mode with `export const prerender = true`. - -For on-demand rendered pages in `server` (default) or `hybrid` (with `export const prerender = false`) mode, the middleware runs in the deployed website when the route is requested. -::: +Middleware also allows you to set and share request-specific information across endpoints and pages by mutating a `locals` object that is available in all Astro components and API endpoints. This object is available even when this middleware runs at build time. ## Basic Usage @@ -200,3 +192,9 @@ greeting response auth response validation response ``` + +## Error pages + +Middleware will attempt to run for all on-demand rendered pages, even when a matching route cannot be found. This includes Astro's default (blank) 404 page and any custom 404 pages. However, it is up to the [adapter](/en/guides/server-side-rendering/) to decide whether that code runs. Some adapters may serve a platform-specific error page instead. + +Middleware will also attempt to run before serving a 500 error page, including a custom 500 page, unless the server error occured in the execution of the middleware itself. If your middleware does not run successfully, then you will not have access to `Astro.locals` to render your 500 page. diff --git a/src/content/docs/en/guides/view-transitions.mdx b/src/content/docs/en/guides/view-transitions.mdx index ae7f93df52a31..60ddc7d45b5b3 100644 --- a/src/content/docs/en/guides/view-transitions.mdx +++ b/src/content/docs/en/guides/view-transitions.mdx @@ -112,10 +112,10 @@ For example, the following `