Documentation Monster Template Syntax

VS Code language extension providing syntax highlighting and embedded C# support for DocMonster HTML templates.
Features
- Full HTML syntax highlighting (inherits from VS Code's built-in HTML grammar)
- C# syntax highlighting inside DocMonster template delimiters
- Embedded C# language support (bracket matching, comment toggling, auto-closing pairs)
- Automatic association for
.dmhtml, .wwscript, and .wwshtml files
| Delimiter |
Purpose |
Example |
{{ expr }} |
HTML-encoded output |
{{ Topic.Title }} |
{{! expr }} |
Raw/unencoded output |
{{! Helpers.Markdown(Topic.Body) }} |
{{: expr }} |
Explicit HTML-encoded output |
{{: Topic.Abstract }} |
{{% code }} |
C# statement block |
{{% if (!string.IsNullOrEmpty(Topic.Keywords)) { }} |
Multi-line Code Blocks
{{%
var name = "Rick";
if (string.IsNullOrEmpty(name)) { }}
<div>{{ name }}</div>
{{% } }}
File Associations
.dmhtml, .wwscript, .wwshtml files — automatically recognized via the extension's language contribution
.html files — add workspace files.associations in .vscode/settings.json:
{
"files.associations": {
"*.html": "docmonster-template"
}
}
Installation
From VSIX file (recommended for sharing)
- Build the VSIX (see Building a VSIX below)
- In VS Code, open the Command Palette (
Ctrl+Shift+P)
- Run Extensions: Install from VSIX...
- Select the
.vsix file
Or from the command line:
code --install-extension docmonster-template-syntax-0.1.0.vsix
Manual folder install
Copy the extension folder to:
%USERPROFILE%\.vscode\extensions\docmonster-template-syntax
Then reload VS Code.
Development mode
- Open the
docmonster-template-syntax folder in VS Code
- Press F5 to launch an Extension Development Host
- Open template files to verify highlighting
Building a VSIX
The extension uses @vscode/vsce to package into an installable .vsix file.
Prerequisites
npm install -g @vscode/vsce
Package
cd docmonster-template-syntax
vsce package
This produces docmonster-template-syntax-0.1.0.vsix in the extension folder.
Scope and Limitations
This extension provides:
- Syntax coloring for HTML and embedded C# in template delimiters
- Embedded-language editor behavior (bracket matching, comments) inside C# regions
This extension does not provide:
- C# IntelliSense or autocompletion inside template regions
- Roslyn diagnostics, rename, or semantic symbol awareness
- Full language server support for mixed HTML/C# template editing
These would require a custom language server or virtual-document projection design in a future phase.
TextMate Scopes
| Region |
Scope |
{{ }} delimiters |
punctuation.section.embedded.begin/end.docmonster |
{{! }} delimiters |
punctuation.section.embedded.begin/end.docmonster.raw |
{{: }} delimiters |
punctuation.section.embedded.begin/end.docmonster.encoded |
{{% }} delimiters |
punctuation.section.embedded.begin/end.docmonster.code |
| Expression content |
meta.embedded.inline.csharp |
| Code block content |
meta.embedded.block.csharp |