WebSpark.PrismSpark
A powerful C# port of PrismJS for server-side syntax highlighting with advanced features, theming support, and 20+ programming languages.
Key Features
20+ Programming Languages
Support for C#, JavaScript, Python, SQL, JSON, HTML, CSS, XML, YAML, Bash, PowerShell, Java, Rust, C, C++, and more.
Advanced Theming System
Built-in themes (Prism, Dark, Tomorrow Night, Solarized) with CSS generation and custom theme creation support.
Plugin Architecture
Extensible plugin system with built-in plugins for line numbers, copy-to-clipboard, syntax validation, and more.
High Performance
Optimized tokenization engine with efficient parsing and highlighting for excellent server-side performance.
Multiple Highlighters
Choose from HtmlHighlighter, EnhancedHtmlHighlighter, or ThemedHtmlHighlighter based on your needs.
Easy Integration
Simple NuGet package installation with dependency injection support for ASP.NET Core applications.
Installation & Setup
Install NuGet Package
Install the WebSpark.PrismSpark package using the Package Manager Console:
Or using Package Manager:
Configure Services (ASP.NET Core)
Register PrismSpark services in your Program.cs:
Quick Start Examples
Basic Tokenization
Simple code tokenization using the core Prism engine:
HTML Highlighting
Generate highlighted HTML with CSS classes:
Advanced Features
Create complete HTML pages with embedded CSS using the ThemedHtmlHighlighter:
Use EnhancedHtmlHighlighter for advanced features like line numbers and highlighted lines:
Create and register custom themes for unique styling:
Extend functionality with the built-in plugin system:
Supported Programming Languages
Built-in Themes
console.log('Hi!');
}
Prism
Classic light theme
console.log('Hi!');
}
Dark
Modern dark theme
console.log('Hi!');
}
Tomorrow Night
Popular dark theme
console.log('Hi!');
}
Solarized Light
Elegant light theme
API Documentation
Core Classes
- Prism- Core tokenization engine
- LanguageGrammars- Grammar definitions
- IHighlighter- Highlighter interface
- HtmlHighlighter- Basic HTML output
- EnhancedHtmlHighlighter- Advanced features
- ThemedHtmlHighlighter- With theming
Theme System
- ThemeManager- Theme management
- Theme- Theme configuration
- ThemeStyle- Style definitions
- CssGenerator- CSS generation
- CssOptions- CSS configuration
Plugin System
- PluginManager- Plugin coordination
- IPlugin- Plugin interface
- HighlightOptions- Configuration
- HooksSystem- Event hooks
Ready to Get Started?
Experience the power of WebSpark.PrismSpark in your next project