Skip to content

ventojs/tree-sitter-vento

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

74 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tree-sitter-vento

Tests Discord

A tree-sitter parser for the Vento templating language.

Features

  • Full support for Vento template syntax
  • YAML front matter parsing with language injection
  • JavaScript code injection for dynamic expressions
  • HTML content injection for template markup
  • Syntax highlighting for all Vento constructs

Supported Keywords

All Vento keywords are properly parsed and highlighted:

Control Flow

  • {{ if }} / {{ /if }} - Conditional blocks
  • {{ else if }} - Else-if branches
  • {{ else }} - Else branches
  • {{ for }} / {{ /for }} - Loop blocks (with optional await)

Variables and Output

  • {{ set }} / {{ /set }} - Variable assignment (tag and block forms)
  • {{ echo }} - Output expressions

Layout and Composition

  • {{ layout }} / {{ /layout }} - Layout blocks
  • {{ slot }} / {{ /slot }} - Slot definitions
  • {{ default }} / {{ /default }} - Default content blocks
  • {{ include }} - Include other templates
  • {{ fragment }} / {{ /fragment }} - Fragment blocks (plugin)

Functions and Modules

  • {{ function }} / {{ /function }} - Function definitions (with optional async and export)
  • {{ import }} - Import from other templates
  • {{ export }} / {{ /export }} - Export variables (tag and block forms)

Special Tags

  • {{> }} - JavaScript execution tag
  • {{# #}} - Comment tag

Front Matter Support

The parser supports YAML front matter at the beginning of Vento templates:

---
title: My Page
date: 2024-01-01
tags:
  - vento
  - template
---

<h1>{{ title }}</h1>

The YAML content within the front matter delimiters (---) will be properly injected and highlighted as YAML.

About

Vento grammar for tree-sitter

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors