VSCode CUE in Markdown Syntax Highlighting
A Visual Studio Code extension that provides CUE language syntax highlighting within Markdown code blocks.
Overview
This extension enables proper syntax highlighting for CUE (Configure, Unify, Execute) language code when used within Markdown code blocks in VSCode. It automatically detects CUE code blocks and applies appropriate syntax highlighting rules.

Features
- Automatic CUE Detection: Automatically recognizes CUE code blocks in Markdown files
- Full Syntax Highlighting: Provides complete syntax highlighting for CUE language features including:
- Keywords (
package, import, if, etc.)
- Data types (
string, int, float, bool)
- Operators (
&&, ||, ==, >, <, etc.)
- Comments (both single-line
// and multi-line /* */)
- Struct definitions and field declarations
- Constraints and computed fields
- List comprehensions and advanced CUE features
Installation
- Install from the Visual Studio Code Marketplace
- Or install manually by cloning this repository and running:
npm install
npm run compile
npm run package
// install ./vscode-cue-in-markdown-0.1.0.vsix extension
Usage
Simply use CUE code blocks in your Markdown files:
```cue
package example
// This will be syntax highlighted
person: {
name: "John Doe"
age: 30
active: true
}
```
The extension automatically detects the cue language identifier and applies appropriate syntax highlighting.
Supported CUE Features
The extension supports highlighting for:
- Basic Syntax: Package declarations, imports, comments
- Data Types:
string, int, float, bool, and custom types
- Structures: Nested objects, field declarations, constraints
- Operators: Logical (
&&, ||), comparison (==, !=, >, <), arithmetic
- Advanced Features: Conditional logic, computed fields, list comprehensions
- Error Handling: Syntax errors are highlighted appropriately
Technical Implementation
The extension uses VSCode's grammar injection system to:
- Detect Markdown code blocks with
cue language identifier
- Inject CUE syntax rules into the Markdown context
- Apply the standard CUE language syntax highlighting within those blocks
Key files:
syntaxes/cue-injection.json: Grammar injection rules
syntaxes/cue.tmLanguage.json: CUE syntax definition
extension.js: Main extension activation logic
Development
To contribute or modify this extension:
- Clone the repository
- Install dependencies:
npm install
- Make your changes
- Test with the provided
test-cue-syntax.md file
- Build:
npm run compile
- Package:
npm run package
License
MIT License
Contributing
Contributions are welcome! Please open issues for bugs or feature requests, and submit pull requests for improvements.
Support
For issues or questions, please open a GitHub issue on the project repository.
Enjoy better CUE syntax highlighting in your Markdown documentation!