Advanced
Documentation menu
Use these notes when Prism becomes part of a long running service or a content pipeline with strict error handling.
Service lifetime
IPrismService is a singleton and its members are thread safe. Resolve it once and inject it where it is needed. Each instance starts its own Node.js process, so creating many instances costs memory and startup time.
Language aliases
The language argument must be a valid Prism alias. If aliases come from user input, call IsValidLanguageAliasAsync before HighlightAsync. The Prism language list is the authority for valid values.
Static API
StaticPrismService is convenient for console tools and tests. In an application that already uses a container, prefer IPrismService so lifetime and replacement stay explicit.
Disposal
The underlying Node.js process exits when its parent dies. You can also call Dispose() on the service. After disposal, calls throw ObjectDisposedException.