Skip to content

Commit 7728535

Browse files
borlandclaude
andauthored
Upgrade to Astro 7 (#3243)
* Upgrade to Astro 7 and fix breaking changes Bumps astro to ^7.0.9 and @astrojs/mdx to ^7.0.3, and resolves the breaking changes surfaced by the upgrade: - Header.astro: mark the theme-switcher <script> as `is:inline`. Astro 7 hands non-inline scripts to Vite for bundling, which cannot resolve the `/docs/js/modules/theme-switcher.js` public asset and failed the build. Inlining emits it verbatim so the browser resolves it at runtime. - astro.config.mjs: move remark plugins from the deprecated `markdown.remarkPlugins` into `markdown.processor: unified({ ... })` from @astrojs/markdown-remark (added as a direct dependency since it is now imported by the config). `trailingSlash` was not honored in its location, so it was removed, and drop the dead `extendDefaultPlugins`. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * Set compressHTML: true --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent f707928 commit 7728535

4 files changed

Lines changed: 692 additions & 127 deletions

File tree

astro.config.mjs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
import remarkDirective from 'remark-directive';
22
import remarkHeading from 'remark-heading-id';
33
import { defineConfig } from 'astro/config';
4+
import { unified } from '@astrojs/markdown-remark';
45
import mdx from '@astrojs/mdx';
56
import { attributeMarkdown, wrapTables } from '/src/themes/octopus/utilities/custom-markdown.mjs';
67
import llmMdEmitter from './src/integrations/llm-md-emitter.ts';
78

89
// https://astro.build/config
910
export default defineConfig({
1011
site: 'https://octopus.com',
12+
compressHTML: true, // preserve astro v6 behavior - https://docs.astro.build/en/guides/upgrade-to/v7/
1113
integrations: [
1214
mdx(),
1315
llmMdEmitter()
@@ -16,14 +18,14 @@ export default defineConfig({
1618
shikiConfig: {
1719
theme: 'light-plus'
1820
},
19-
remarkPlugins: [
20-
remarkDirective,
21-
remarkHeading,
22-
attributeMarkdown,
23-
wrapTables
24-
],
25-
trailingSlash: 'never',
26-
extendDefaultPlugins: true,
21+
processor: unified({
22+
remarkPlugins: [
23+
remarkDirective,
24+
remarkHeading,
25+
attributeMarkdown,
26+
wrapTables
27+
],
28+
}),
2729
},
2830
server: {
2931
port: 3000

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@
2828
"watch": "onchange 'src/**/*.{js,mjs,ts,astro,css}' 'public/docs/js/**/*.js' 'public/docs/css/**/*.css' -- prettier --write --plugin=prettier-plugin-astro {{changed}}"
2929
},
3030
"dependencies": {
31-
"@astrojs/mdx": "^5.0.4",
32-
"astro": "^6.3.1",
31+
"@astrojs/markdown-remark": "7.2.1",
32+
"@astrojs/mdx": "^7.0.3",
33+
"astro": "^7.0.9",
3334
"astro-accelerator-utils": "^0.3.84",
3435
"glob": "^13.0.6",
3536
"gray-matter": "^4.0.3",

0 commit comments

Comments
 (0)