Syntax highlighting and code snippets for RapidWeaver Elements templates in VS Code and Cursor.
- Open VS Code or Cursor
- Press
Cmd+Shift+X(Mac) orCtrl+Shift+X(Windows/Linux) to open Extensions - Search for "RapidWeaver Elements"
- Click Install
# VS Code
code --install-extension elements-platform.rwelements
# Cursor
cursor --install-extension elements-platform.rwelementsDownload the .vsix file from GitHub Releases and install via:
- VS Code/Cursor:
Cmd+Shift+P→ "Install from VSIX"
- Open any
.htmlor.phpfile in atemplates/folder - The extension automatically activates with syntax highlighting
- Type
rw-to see available snippets
That's it! Your RapidWeaver Elements code is now highlighted.
Full syntax highlighting for all RapidWeaver Elements directives in HTML and PHP files:
| Directive | Description |
|---|---|
@if, @else, @elseif, @endif |
Conditional rendering |
@each, @endeach |
Loop through collections |
@template, @endtemplate |
Define inline reusable templates |
@include, @includeIf |
Include templates with parameters |
@text, @dropzone |
Content directives |
@portal, @endportal |
Inject content to other locations |
@raw, @endraw |
Output raw template syntax |
{{variable}} |
Variable interpolation |
{{item.property}} |
Property access |
{{item::isFirst}} |
Iterator metadata |
Type a prefix and press Tab to insert a snippet:
| Prefix | Output |
|---|---|
rw-if |
@if(condition)...@endif |
rw-ifelse |
@if...@else...@endif |
rw-each |
@each(item in collection)...@endeach |
rw-template |
@template("name")...@endtemplate |
rw-include |
@include("template", param: value) |
rw-includeif |
@includeIf(condition, template: "name") |
rw-text |
@text("name", title: "Title") |
rw-dropzone |
@dropzone("name", title: "Title") |
rw-dropzone-h |
Horizontal dropzone |
rw-portal |
@portal("bodyEnd")...@endportal |
rw-portal-once |
Portal with includeOnce option |
rw-raw |
@raw()...@endraw |
rw-var |
{{variable}} |
rw-var-prop |
{{object.property}} |
rw-var-iter |
{{item::isFirst}} |
rw-classes |
{{classes.className}} |
rw-component |
Full component scaffold |
rw-alpine |
Alpine.js component wrapper |
- Code Folding - Collapse
@if/@endif,@each/@endeach,@template/@endtemplate,@portal/@endportalblocks - Auto-closing -
{{automatically closes with}} - Bracket Matching - Proper matching for all directive pairs
- Indentation - Smart indentation for nested directives
@if(showContent)
<div class="{{classes.wrapper}}">
@dropzone("content", title: "Content")
</div>
@else
<p>No content available</p>
@endif@each(item in items)
<div class="{{classes.item}}">
<h3>{{item.title}}</h3>
<p>{{item.description}}</p>
@if(item::isFirst)
<span class="badge">First!</span>
@endif
</div>
@endeach@template("button")
<button class="{{classes.button}}">{{label}}</button>
@endtemplate
@include("button", label: "Buy Now")
@include("button", label: "Learn More")@portal("bodyEnd")
<script>
// Script injected at end of body
</script>
@endportalFiles in templates/ folders are automatically detected:
**/templates/**/*.html**/templates/**/*.php
Add to your VS Code/Cursor settings (settings.json):
{
"files.associations": {
"*.elements.html": "rwelements",
"**/my-templates/**/*.html": "rwelements"
}
}- Open any file
- Click the language indicator in the bottom-right corner
- Select "RapidWeaver Elements"
- VS Code 1.60.0+ or Cursor (any version)
- Report Issues: GitHub Issues
- RapidWeaver: realmacsoftware.com/rapidweaver
Contributions are welcome! Please feel free to submit a Pull Request.
MIT License - Copyright (c) Elements Platform