เจาะลึก Astro 6.4: Pluggable Markdown Pipeline, Sätteri ที่ขับเคลื่อนด้วย Rust, และการปฏิวัติการ Deploy บน Cloudflare
เมื่อวันที่ 28 พฤษภาคม 2026 Astro ปล่อย 6.4 มันไม่ใช่ feature bump ทั่วไป หรือ bugfix collection — มันคือ inflection point เชิงโครงสร้าง
สามการเปลี่ยนแปลงหลัก แต่ละอันตัดตามแนวโน้มลึก:
- Markdown processor interface — จุดจบของการผูกขาด unified ที่กินเวลาทศวรรษ
- Sätteri — Rust Markdown/MDX processor ที่เขียนจากศูนย์ ลด CI build time จาก 120s เป็น 55s
- cf() helper — ย่อ 6+ Cloudflare bindings และ context injections เป็นบรรทัดเดียว
Processing เป็น Interface
ภาระทางประวัติศาสตร์
ตั้งแต่第一天 Markdown pipeline ของ Astro เชื่อม hard-wired กับ unified ecosystem โดยเฉพาะ remark (parse Markdown AST) + rehype (transform HTML AST) และ plugins นับพัน ไม่ใช่ปัญหาตัวเอง — unified กว้างและยืดหยุ่น ปัญหาคือมัน hard-coded
คุณไม่สามารถสลับมันออกได้ ถึงคุณต้องการแค่ GFM และ heading anchors ทั้ง remark → rehype → stringify JS pipeline ก็ยังรัน end-to-end
6.4 API markdown.processor เปลี่ยนจาก fixed dependency เป็น interface ที่สลับได้
ไวยากรณ์ config ใหม่
// ❌ Deprecated (ใช้ได้ใน 6.4, จะลบใน 8.0)export default defineConfig({ markdown: { remarkPlugins: ['remark-toc'], rehypePlugins: ['rehype-slug'], },});
// ✅ Astro 6.4+ แนะนำimport { unified } from '@astrojs/markdown-remark';export default defineConfig({ markdown: { processor: unified({ remarkPlugins: ['remark-toc'], rehypePlugins: ['rehype-slug'], smartypants: true, gfm: true, }), },});Sätteri: Rust เข้าสู่ Markdown Pipeline
@astrojs/markdown-sätteri คือ การเขียนใหม่จากศูนย์ ของ Rust Markdown/MDX processor มันไม่ใช่เวอร์ชันเร่งด้วย Rust ของ unified — มันมี AST specification ของตัวเอง, parser ของตัวเอง, serializer ของตัวเอง
Performance Benchmarks
| ไซต์ | Unified (baseline) | Sätteri | ความเร็วขึ้น |
|---|---|---|---|
| Astro docs site | 142s | 63s | 2.25× |
| Cloudflare docs site | 120s | 55s | 2.18× |
| Mid-size marketing site | 38s | 22s | 1.73× |
แต่ compatibility คือข้อแม้
Sätteri ไม่ compatible กับ remark/rehype plugins นี่ไม่ใช่บั๊ก — มันคือความจำเป็นทางสถาปัตยกรรมของ Rust AST pipeline
| ฟีเจอร์ | Unified | Sätteri | หมายเหตุ |
|---|---|---|---|
| GFM | ✅ plugin | ✅ native | ฟรี |
| Smartypants | ✅ plugin | ✅ native | ฟรี |
| directive syntax | ⚠️ ต้องใช้ remark-directive |
✅ native | สะอาดกว่า |
| MDAST/HAST plugins | ✅ ทั้งหมด | ❌ | ข้อจำกัดหลัก |
| Custom components | ✅ MDX | ✅ MDX | Sätteri รองรับ MDX |
Cloudflare Deployment: หก Bindings บีบเป็นหนึ่ง
cf() abstraction
cf(state, env, ctx) ย่อทั้งหกเป็นการเรียกเดียว:
export default defineConfig({ output: 'server', adapter: cloudflare({ advancedRouting: { cf: true }, }),});เส้นทางอัปเกรดปลอดภัย
| เช็ค | Unified path | Sätteri path |
|---|---|---|
| Build time | Baseline | ~50% เร็วขึ้น |
remarkPlugins |
✅ ใช้ได้ | ❌ ต้อง port |
rehypePlugins |
✅ ใช้ได้ | ❌ ต้อง port |
gfm |
✅ plugin | ✅ native |
smartypants |
✅ plugin | ✅ native |
สรุป: ความเร็ว vs ระบบนิเวศ
Astro 6.4 ถามคำถามที่ทุก SSG framework จะต้องเจอ: ความเร็วแบบ native คุ้มกับการเสีย compatibility plugin หรือไม่?
สามสิ่งที่ควรจำ:
- Markdown pipeline ตอนนี้ pluggable — ซึ่งหมายความว่าอาจมี Python processors, Go processors, หรือ browser-native processors ในอนาคต
- โปรเจกต์ที่เนื้อหาหนักสามารถสลับไป Sätteri วันนี้และลด build time ลงครึ่งหนึ่ง
- ผู้ใช้ Cloudflare แทบไม่มีเหตุผลที่จะไม่ใช้
cf()— มันบีบหกบรรทัดของ bindings เป็นหนึ่ง โดยไม่มี side effects
อ้างอิง
- Astro 6.4 Release Blog
- Native Markdown / MDX RFC
@astrojs/markdown-sätterinpm package@astrojs/cloudflareadapter docs- Hono + Astro Integration Example