A modern, feature-rich PyQt5 application for previewing and rendering Velocity templates with real-time syntax highlighting, validation, and export capabilities.
- Clean, modern interface with tabbed layout
- Syntax highlighting for Velocity templates and JSON data
- Responsive design with customizable splitter panes
- Professional styling with hover effects
- Real-time syntax highlighting for Velocity templates and JSON data
- Background rendering for better performance
- Auto-save functionality (every 30 seconds)
- Recent files support with quick access menu
- Template and data validation with detailed error messages
- Export to HTML with professional styling
- Template syntax validation (Ctrl+Shift+V)
- JSON data validation (Ctrl+Shift+D)
- Error highlighting and detailed error messages
- Progress indicators for long operations
- Settings persistence across sessions
- Open/save Velocity templates (.vm files)
- Load JSON data files
- Recent files tracking
- Export rendered output to HTML
- Auto-save with silent operation
- Python 3.9 or higher
- PyQt5
- Airspeed (Velocity template engine)
-
Clone or download the project
git clone <repository-url> cd vm-visualizer
-
Install dependencies
# Using pip pip install PyQt5 airspeed # Or using the project's dependency management pip install -e .
-
Run the application
python main.py
- Open a template: Use
File > Open Template
or drag a.vm
file - Add data: Switch to the "Data" tab and enter JSON data
- Render: Click "Render Template" or press F5
- Export: Use
Tools > Export as HTML
to save the output
Action | Shortcut |
---|---|
Open Template | Ctrl+O |
Save Template | Ctrl+S |
Save Template As | Ctrl+Shift+S |
Render Template | F5 |
Validate Template | Ctrl+Shift+V |
Validate Data | Ctrl+Shift+D |
Exit | Ctrl+Q |
The project includes example files to get you started:
example-template.vm
- A comprehensive Velocity template demonstrating various featuresexample-data.json
- Sample JSON data that works with the example template
The application supports all standard Velocity template features:
$variable
${variable}
#set($variable = "value")
#if($condition)
content
#end
#foreach($item in $list)
$item
#end
## Single line comment
#*
Multi-line comment
*#
vm-visualizer/
├── main.py # Main application entry point
├── utils.py # Utility functions and constants
├── syntax_highlighters.py # Syntax highlighting classes
├── example-template.vm # Example Velocity template
├── example-data.json # Example JSON data
├── pyproject.toml # Project configuration
└── README.md # This file
The application is organized into modular components:
main.py
: Main application window and UI logicutils.py
: Utility functions, constants, and template processingsyntax_highlighters.py
: Syntax highlighting for different languages
- New syntax highlighting: Add classes to
syntax_highlighters.py
- Utility functions: Add to
utils.py
- UI features: Extend the main window class in
main.py
The project uses modern Python packaging:
# Install in development mode
pip install -e .
# Build distribution
python -m build
The application automatically saves and restores:
- Window geometry and position
- Splitter pane sizes
- Recent files list (last 10 files)
Settings are stored in the system's application data directory.
You can customize the application by modifying:
utils.py
- Constants and stylingsyntax_highlighters.py
- Color schemesmain.py
- UI layout and behavior
- Template not rendering: Check for syntax errors using
Tools > Validate Template
- JSON errors: Use
Tools > Validate Data
to check JSON syntax - Performance issues: Large templates are rendered in background threads
The application provides detailed error messages for:
- Template syntax errors
- JSON parsing errors
- File I/O errors
- Rendering errors
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is open source and available under the MIT License.
- Built with PyQt5
- Uses Airspeed for Velocity template processing
- Inspired by modern code editors and IDEs
Happy templating! 🚀