Skip to content

SublimeText/Astro

Repository files navigation

Astro

Astro syntax definitions for Sublime Text based on its HTML, Markdown and JSX syntaxes.

Installation

Package Control

The easiest way to install is using Package Control. It's listed as Astro.

  1. Open Command Palette using ctrl+shift+P or menu item Tools → Command Palette...
  2. Choose Package Control: Install Package
  3. Find Astro and hit Enter

Manual Install

  1. Download appropriate Astro-2.0.0-st4xxx.sublime-package for your Sublime Text build. The st4xxx suffix denotes the least required ST build for the sublime-package to work.
  2. Rename it to Astro.sublime-package
  3. Copy it into Installed Packages directory

Note

To find Installed Packages...

  1. call Menu > Preferences > Browse Packages..
  2. Navigate to parent folder

Requirements

  • Astro 2.0.0 requires Sublime Text 4126+
  • Syntax highlighting in <style> tags is powered by 3rd-party packages
  • Intellisense features are provided by LSP and LSP-astro.

Troubleshooting

§1 Syntax Definition Parse Errors

Astro extends Sublime Text's HTML and Markdown syntax definitions.

If Astro syntax highlighting doesn't work and console displays syntax errors in HTML (Astro).sublime-syntax or Markdown (Astro).sublime-syntax, please make sure to remove any out-dated syntax override.

Steps:

  1. call Menu > Preferences > Browse Packages..
  2. Look for HTML and Markdown folders
  3. Remove them or at least delete any syntax definition in them.

§2 Frontmatter or Components are not highlighted

Astro includes TypeScript (source.ts) and TSX (source.tsx) syntaxes to render Components.

Make sure to remove out-dated TypeScript or TSX syntax packages, which don't meet least compatibility requirements.

They can be identified by calling sublime.find_syntax_by_scope("source.ts") in ST's console.

Known candidates are: