Skip to content

SyntaxHighlightingComponent.registerCodeBlockLanguage method

SyntaxHighlightingComponent › registerCodeBlockLanguage

Registers a fenced code block language, highlighting it in the editor and, optionally, in reading view.

Signature:

registerCodeBlockLanguage(params: SyntaxHighlightingComponentRegisterCodeBlockLanguageParams): Promise<void>

Parameters:

ParameterTypeDescription
paramsSyntaxHighlightingComponentRegisterCodeBlockLanguageParamsThe parameters for registering the language.

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

Example:

await component.registerCodeBlockLanguage({
editorMode: 'text/typescript',
language: 'my-language',
prismGrammar: 'typescript'
});