Skip to content

SyntaxHighlightingComponent.registerPrismLanguage method

SyntaxHighlightingComponent › registerPrismLanguage

Registers a Prism language, highlighting it everywhere Prism renders code — reading view and the CodeHighlighterComponent settings field.

Signature:

registerPrismLanguage(params: SyntaxHighlightingComponentRegisterPrismLanguageParams): Promise<void>

Parameters:

ParameterTypeDescription
paramsSyntaxHighlightingComponentRegisterPrismLanguageParamsThe parameters for registering the language.

Returns: Promise<void>A Promise that resolves when the language is registered.

Example:

await component.registerPrismLanguage({
grammar: {
keyword: /\bfoo\b/
},
language: 'my-language'
});