feat: add defaultLanguage option to CodeBlockLowlight extension, fix #2121

This commit is contained in:
Philipp Kühn
2021-11-05 14:00:44 +01:00
parent b5b9363b49
commit 0f94bcd591
3 changed files with 35 additions and 5 deletions

View File

@@ -4,6 +4,7 @@ import { LowlightPlugin } from './lowlight-plugin'
export interface CodeBlockLowlightOptions extends CodeBlockOptions {
lowlight: any,
defaultLanguage: string | null | undefined,
}
export const CodeBlockLowlight = CodeBlock.extend<CodeBlockLowlightOptions>({
@@ -11,6 +12,7 @@ export const CodeBlockLowlight = CodeBlock.extend<CodeBlockLowlightOptions>({
return {
...this.parent?.(),
lowlight,
defaultLanguage: null,
}
},
@@ -20,6 +22,7 @@ export const CodeBlockLowlight = CodeBlock.extend<CodeBlockLowlightOptions>({
LowlightPlugin({
name: this.name,
lowlight: this.options.lowlight,
defaultLanguage: this.options.defaultLanguage,
}),
]
},