tree-sitter-astro-next

An Astro grammar for tree-sitter, compatible with tree-sitter 0.25+

Library
Cargo
v0.1.1
0stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
9/100Needs Attention
Development Activity4
Maintenance0
Community4
Maturity28
Momentum0

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
68/100Good
Architecture74
Code Quality66
Innovation70
Learning Curve62

tree-sitter-astro-next is a tree-sitter grammar for the Astro web framework’s file format, compatible with tree-sitter 0.25 and later. It parses Astro components into a concrete syntax tree that updates incrementally as code changes, enabling syntax highlighting, code navigation, and other editor features for Astro files.

The grammar handles Astro’s distinctive structure, including the frontmatter fence, HTML-like template markup, and embedded expressions, and ships as a Rust crate for use in tree-sitter-based editors and tooling.

What You Get

  • A tree-sitter grammar for Astro files with a generated C parser
  • Compatibility with tree-sitter 0.25 and later versions
  • Support for Astro frontmatter blocks, template markup, and embedded expressions
  • A Rust crate for integrating Astro parsing into editors and tools

Common Use Cases

  • Syntax highlighting for Astro files in tree-sitter-based editors
  • Code navigation and structural editing of Astro components
  • Editor and language-tooling support for the Astro framework
  • Static analysis of Astro frontmatter and template markup

Under The Hood

Architecture - The grammar is defined in grammar.js using tree-sitter’s DSL and compiled to a C parser with an external scanner that separates Astro’s frontmatter fence from its HTML-like template body and embedded expressions. The binding exposes a language() entry point for a tree-sitter runtime.

Tech Stack - The generated parser is C (the repo’s primary language); the grammar definition is JavaScript. The package is published as a Rust crate targeting tree-sitter 0.25+, built with the standard tree-sitter binding toolchain.

Code Quality - A newer, single-maintainer grammar focused on tree-sitter 0.25 compatibility. It is early-stage (v0.1.x) with modest adoption, but explicitly documents its Astro-specific syntax handling in the README.

API Design - Usage is a single call: import the binding and pass its language object to a tree-sitter parser. The -next naming signals it as an updated grammar aligned with recent tree-sitter releases.

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search