惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

C
Cisco Blogs
Cyberwarzone
Cyberwarzone
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
SecWiki News
SecWiki News
Martin Fowler
Martin Fowler
T
Tor Project blog
N
Netflix TechBlog - Medium
C
Cybersecurity and Infrastructure Security Agency CISA
V
Vulnerabilities – Threatpost
V
Visual Studio Blog
GbyAI
GbyAI
PCI Perspectives
PCI Perspectives
D
DataBreaches.Net
Jina AI
Jina AI
H
Heimdal Security Blog
云风的 BLOG
云风的 BLOG
P
Privacy International News Feed
A
About on SuperTechFans
J
Java Code Geeks
美团技术团队
H
Hackread – Cybersecurity News, Data Breaches, AI and More
N
News | PayPal Newsroom
有赞技术团队
有赞技术团队
MyScale Blog
MyScale Blog
博客园 - 司徒正美
C
Check Point Blog
T
Threat Research - Cisco Blogs
Attack and Defense Labs
Attack and Defense Labs
宝玉的分享
宝玉的分享
AI
AI
Simon Willison's Weblog
Simon Willison's Weblog
C
Cyber Attacks, Cyber Crime and Cyber Security
I
Intezer
P
Proofpoint News Feed
Blog — PlanetScale
Blog — PlanetScale
Apple Machine Learning Research
Apple Machine Learning Research
Hugging Face - Blog
Hugging Face - Blog
The Last Watchdog
The Last Watchdog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Vercel News
Vercel News
I
InfoQ
阮一峰的网络日志
阮一峰的网络日志
Cisco Talos Blog
Cisco Talos Blog
W
WeLiveSecurity
Hacker News: Ask HN
Hacker News: Ask HN
Recent Commits to openclaw:main
Recent Commits to openclaw:main
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
D
Docker
博客园 - Franky
Security Archives - TechRepublic
Security Archives - TechRepublic

The Astro Blog

Astro 6.4 Astro 6.3 Starlight 0.39 Astro 6.2 What's new in Astro - April 2026 What's new in Astro - March 2026 Astro 6.1 CloudCannon Joins Astro as an Official CMS Partner Astro 6.0 What's new in Astro - February 2026 What's new in Astro - January 2026 Astro 5.17 Supporting the future of Astro The Astro Technology Company joins Cloudflare Astro 6 Beta What's new in Astro - December 2025 What's new in Astro - November 2025 Astro 5.16 Stainless Sponsors Astro, Launches Astro-Powered Docs Platform What's new in Astro - October 2025 Astro 5.15 Spirit of Astro: meet the winning designs What's new in Astro - September 2025 Astro 5.14 Cloudflare Donates $150,000 to Support Astro's Open Source Mission Webflow Donates $150,000 to Support Astro's Open Source Mission Mux: Our Official Video Partner Unleashing creativity: How CodeTV built a video streaming platform with Astro and Mux | Astro What's new in Astro - August 2025 Astro 5.13 What's new in Astro - July 2025 Astro 5.12 Starlight 0.35 Astro 5.11 What's new in Astro - June 2025 Live Content Collections: A Deep Dive Introducing… Astro Mart Astro Solstice Festival Astro 5.10 Astro 5.9 What's new in Astro - May 2025 Astro 5.8 What's new in Astro - April 2025 2025 Technical Steering Committee Starlight April Update Astro 5.7 Astro Agency Partner Program Astro 5.6 What's new in Astro - March 2025 What's new in Astro - February 2025 Astro 5.4 Starlight 0.32 Astro 5.3 What's new in Astro - January 2025 Astro 5.2 2024 year in review What's new in Astro - December 2024 Astro 5.1 Astro 5.0 Google IDX: Our Official Online Editor Partner What's new in Astro - November 2024 What's new in Astro - October 2024 Astro x Cloudinary SDK What's new in Astro - September 2024 Community Loaders for Astro Content Layer Astro x Hygraph: Content Loader Astro x Cloudinary: Content Loader Astro x Storyblok: Content Loader Content Layer: A Deep Dive Starlight 0.28 Astro 5.0 Beta Release The $100,000 Astro Ecosystem Fund Fall Update Goodbye Studio, Hello DB What's new in Astro - August 2024 Astro 4.15 Astro 4.14 Astro 4.13 What's new in Astro - July 2024 Astro 4.12: Server Islands Netlify: Our Official Deployment Partner What's new in Astro - June 2024 Astro 4.11 Astro Together 2024 Server Islands The Astro Content Layer Zero-JavaScript View Transitions Astro 4.10 Starlight turns one year old! What's new in Astro - May 2024 Astro 4.9 Astro 4.8 What's new in Astro - April 2024 Astro 4.7 Astro 4.6 What's new in Astro - March 2024 Migrating 500+ tests from Mocha to Node.js Astro DB: A Deep Dive The Astro Developer Portal Astro DB Astro 4.5
Astro 5.5
Matt Kane · 2025-03-13 · via The Astro Blog

Astro 5.5 dives deep with better support for diagramming tools, improved Markdown compatibility, and type-safe sessions!

🧜‍♀️ Dive into a sea of new features with these improvements to Astro:

  • Better support for diagramming tools in Markdown
  • Type-safe experimental sessions
  • Improved heading ID compatibility
  • Experimental: preserve order of style and script tags

To upgrade an existing project, use the automated @astrojs/upgrade CLI tool. Alternatively, upgrade manually by running the upgrade command for your package manager:

# Recommended:

npx @astrojs/upgrade

# Manual:

npm install astro@latest

pnpm upgrade astro --latest

yarn upgrade astro --latest

Tools like Mermaid and D2 let you define charts and diagrams in code blocks in Markdown, which are then rendered inside the content. Until now, using these in Astro could be tricky, because Astro’s default syntax highlighting would interfere with how the code blocks were rendered.

Astro 5.5 introduces a new excludeLangs option in your Markdown configuration that makes it possible to skip syntax highlighting for specific language code blocks. This unlocks the ability to use tools like these without disabling syntax highlighting for other blocks.

Here’s an example of how to configure Astro to disable highlighting for the mermaid language after installing the rehype-mermaid plugin:

import { defineConfig } from 'astro/config';

import rehypeMermaid from 'rehype-mermaid';

export default defineConfig({

markdown: {

syntaxHighlight: {

type: 'shiki',

excludeLangs: ['mermaid', 'math'],

},

rehypePlugins: [rehypeMermaid],

},

});

Then, you can create diagrams directly in your Markdown content:

```mermaid

graph TD

A[Start] --> B{Is it working?}

B -->|Yes| C[Great!]

B -->|No| D[Debug]

D --> B

```

This will then render as a diagram in your page.

Massive thanks to Chris Chua for this contribution.

Type-safe experimental sessions

Astro 5.5 adds support for proper TypeScript typing for your session data, letting you banish any mistakes. Experimental support for session storage was added in Astro 5.1, but previously all session data was untyped. Now you can define the types of your session data by extending the global App.SessionData interface in your project’s src/env.d.ts file:

declare namespace App {

interface SessionData {

user: {

id: string;

email: string;

};

lastLogin: Date;

}

}

This is optional, and any keys not defined in this interface will be treated as any. However, defining the types will provide accurate type checking and autocomplete when working with session data in your site:

---

const user = await Astro.session.get('user');

// `user` is properly typed as `{ id: string; email: string; } | undefined`

const something = await Astro.session.get('something');

// `something` is typed as `any` since it's not defined in the interface

// TypeScript will catch this error:

Astro.session.set('user', 1); // Error: Type 'number' is not assignable to type '{ id: string; email: string; }'

---

This improvement makes working with sessions in Astro more reliable and helps catch potential errors at development time rather than at runtime.

For more information, see the experimental sessions docs.

Improved heading ID compatibility

Astro 5.5 introduces a new experimental.headingIdCompat flag that generates heading IDs consistent with other common Markdown processors like those used by GitHub and npm.

By default, Astro removes trailing dashes from the end of IDs it generates for headings containing special characters. This behavior differs from other common Markdown processors, which can cause inconsistencies when linking to headings across different platforms.

With the new configuration flag, you can now ensure your heading IDs follow the same convention as other platforms:

import { defineConfig } from 'astro/config';

export default defineConfig({

experimental: {

headingIdCompat: true,

},

});

This is particularly useful for sites that might have anchor links shared between GitHub, npm documentation, and your Astro website.

Experimental flags aren’t only for cool new features. Sometimes, things just have to change. We also use experimental flags to carefully introduce you to breaking changes that will eventually become the new default behavior. experimental.preserveScriptOrder is one of them!

When rendering multiple <style> and <script> tags on the same page, Astro currently reverses their order in your generated HTML output. This can give unexpected results, for example CSS styles that apply in development mode being overridden by earlier style tags once your site is built.

You can enable it in your configuration like this:

import { defineConfig } from 'astro/config';

export default defineConfig({

experimental: {

preserveScriptOrder: true,

},

});

With the new preserveScriptOrder flag set to true, Astro will generate your styles and scripts in the order they are defined. If you were previously compensating for Astro’s behavior by writing these out of order, you will need to update your code.

We think this change makes sense in the long run for everyone, so we encourage you to test this now to ensure it works before it becomes the default behavior.

Thanks to JaneSmith for first identifying this issue, and Reuben Tier for contributing the compiler fix!

Bug fixes

As always, we’ve been working hard on fixing issues since the 5.4 release. See the changelog for all the details.

Thanks

Thanks to everyone who contributed to this release, including Chris Swithinbank, Emanuele Stoppa, Reuben Tier, Luiz Ferraz, Sarah Rainsberger, HiDeoo, HappyDev, Yan Thomas, Bjorn Lu, Chris Chua, and many more.

We look forward to seeing what you build with Astro 5.5! If you have questions, comments, or just want to say hi, drop by the Astro Discord.