Skip to content

feat: add support to astro syntax - #26

Merged
davatron5000 merged 2 commits into
davatron5000:mainfrom
felixicaza:feat/astro
Sep 9, 2026
Merged

davatron5000 merged 2 commits into
davatron5000:mainfrom
felixicaza:feat/astro

Conversation

@felixicaza

Copy link
Copy Markdown
Contributor

What does this change?

This PR adds a new grammar to support .astro file syntax based on the Astro Language Tools syntax definition, and reuses MicroLighter's existing HTML, CSS, SCSS, TypeScript and TSX grammars for embedded content.

Astro files combine a TypeScript frontmatter section with an HTML/JSX-like template, where expressions can be embedded directly in markup and <script> and <style> blocks can contain JavaScript or TypeScript, CSS or SCSS respectively.

This grammar includes:

  • Astro frontmatter.
  • <script> and <style> blocks.
  • Interpolations.
  • Embedded HTML/CSS/SCSS/TypeScript/TSX syntax.

Other reference:

Playground preview:

image

Checklist

  • npm test passes locally
  • The size budget still passes (note any size impact below)
  • Added/updated tests or the demo (docs/index.html) if behavior changed
  • For a new grammar/theme, followed the steps in CONTRIBUTING.md

Size impact

Bundles
                               file       raw      gzip    brotli
  ---------------------------------  --------  --------  --------
           dist/microlighter.min.js  4.52 KiB  2.09 KiB  1.91 KiB
  dist/micro-lighter-element.min.js  8.81 KiB  3.59 KiB  3.17 KiB

Lazy-loaded chunks (fetched on demand)

                        file  raw (min)      gzip
  --------------------------  ---------  --------
           grammars/astro.js   1.61 KiB  0.49 KiB

Average chunk size

  category  files  raw (min)      gzip
  --------  -----  ---------  --------
  grammars     38   1.69 KiB  0.73 KiB

Budget: dist/microlighter.min.js gzip 2.09 KiB / 2.10 KiB (ok)

@davatron5000

davatron5000 commented Sep 9, 2026

Copy link
Copy Markdown
Owner

@copilot resolve the merge conflicts in this pull request

Lol. this did nothing.

@davatron5000
davatron5000 merged commit 559660d into davatron5000:main Sep 9, 2026
@davatron5000

Copy link
Copy Markdown
Owner

Thanks @felixicaza! Got it in. Will cut a release soon'ish.

@felixicaza
felixicaza deleted the feat/astro branch September 9, 2026 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants