Introduction
Documentation menu
Jering.Web.SyntaxHighlighters.Prism lets .NET applications use Prism, the lightweight JavaScript syntax highlighter, without running a separate JavaScript toolchain.
Overview
The library hosts Prism in Node.js and exposes two operations through IPrismService: highlight a block of code and check whether a language alias is valid. Highlighting returns markup that can be written into a page, an email or a documentation build.
Prism is widely used on the web because it is small, has broad language support and produces predictable markup. This wrapper keeps that output consistent between a .NET service and any browser side rendering that uses the same highlighter.
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. The second argument to HighlightAsync must be a valid Prism language alias.
Supported workflows
- Highlight code inside a content pipeline before the page is served.
- Validate user supplied language names before they reach the highlighter.
- Share one service instance across requests because its members are thread safe.
Next steps
Follow the Quick Start, then read Exception Handling for the failure cases that matter in a service.