Introduction
Documentation menu
Jering.Web.SyntaxHighlighters.HighlightJS lets .NET applications use highlight.js from C#. The highlighter runs in Node.js and returns markup with the familiar hljs class names.
Overview
The library exposes IHighlightJSService. Call HighlightAsync with source code and a language alias, or call IsValidLanguageAliasAsync first when the language comes from user input. The service can apply a custom class prefix if your stylesheet expects one.
highlight.js is known for automatic language detection and a broad language set. This package is for teams that already standardize on its markup and want to produce the same output from a .NET build or service.
Requirements
Node.js must be installed and available on the PATH. The package targets .NET Standard 2.0 and .NET Framework 4.6.1 and has been tested with Node.js versions 10.5.2 through 12.13.0.
When to use it
- Your site or documentation theme already uses highlight.js.
- You need to highlight code during a server side build.
- You want to validate language aliases before rendering untrusted content.
Next steps
Start with the Quick Start and keep the Advanced notes nearby for configuration details.