
Official Website | Documentation | Template Repository | JS/TS version | PHP version | VSCode Extension
This extension provides syntax highlighting to template files for MTRGen (matronator/mtrgen-js) templates. It also provides a command to create files from MTRGen templates.
Features
- Syntax highlighting for MTRGen templates
- Snippets for MTRGen templates
- File creation from MTRGen templates
- Command to create files from MTRGen templates
Create files from MTRGen templates
This extension adds a button to the file explorer and a coresponding command to create files from MTRGen templates. Just run the command MTRGen: Create File from MTRGen Template and select a template from the list. If you have no MTRGen templates, the extension will create a .mtrgen folder in your project root and prompt you to create a new template.
Snippets
The extension provides common snippets for MTRGen templates. The following snippets are available:
| Snippet | Description | Example output |
|---|---|---|
header, ---, mtr |
Creates MTRGen header block | --- MTRGEN --- |
var |
Creates a variable placeholder | <% $foo %> |
var= |
Creates a variable placeholder with a default value | <% $foo='default' %> |
| `var | ` | Creates a variable placeholder with a filter |
| `var= | ` | Creates a variable placeholder with a default value and filter |
if |
Creates an if statement block |
<% if true %> |
ifelseif, ifei |
if statement block with elseif block |
<% if true %> |
ifelse, ife |
if statement block with an else block |
<% if true %> |
ifelseifelse, ifeie |
if statement block with elseif and else blocks |
<% if true %> |
else |
else block |
<% else %> |
elseif, elif |
elseif block |
<% elseif false %> |
comment, #, // |
Comment block | <# This is a comment #> |
for |
for loop block |
<% for item in items %> |
first |
first block |
<% first %> |
last |
last block |
<% last %> |
sep |
sep block |
<% sep %> |
empty |
empty block |
<% empty %> |
Supported languages
This extension adds language support for these languages natively or with support from third-party extensions:
- C
- C++
- C#
- Clarity
- CSS
- Dart
- Dockerfile
- Elixir
- Elm
- Erlang
- Gleam
- Go
- Haskell
- Haxe
- HTML
- Java
- JavaScript (including React)
- JSON
- Julia
- KDL
- Kotlin
- Less
- Lisp
- Lua
- Markdown
- Nim
- Objective-C
- OCaml
- Odin
- Perl
- PHP
- PowerShell
- Python
- Ruby
- Rust
- Scala
- SCSS
- Shellscript
- Solidity
- Swift
- Terraform
- TOML
- TypeScript (including React)
- XML
- YAML
- Zig
License
This extension is released under the MIT License.