github.com/ngocphuongnb/tetua@v0.0.7-alpha/packages/editor/src/extensions/codeblock-lowlight/code-block-lowlight.ts (about) 1 import * as lowlight from 'lowlight/lib/core' 2 import CodeBlock, { CodeBlockOptions } from '@tiptap/extension-code-block' 3 import { LowlightPlugin } from './lowlight-plugin' 4 5 export interface CodeBlockLowlightOptions extends CodeBlockOptions { 6 lowlight: any, 7 defaultLanguage: string | null | undefined, 8 } 9 10 export const CodeBlockLowlight = CodeBlock.extend<CodeBlockLowlightOptions>({ 11 addOptions() { 12 return { 13 ...this.parent?.(), 14 lowlight: (lowlight as any).lowlight, 15 defaultLanguage: null, 16 } 17 }, 18 19 addProseMirrorPlugins() { 20 return [ 21 ...this.parent?.() || [], 22 LowlightPlugin({ 23 name: this.name, 24 lowlight: this.options.lowlight, 25 defaultLanguage: this.options.defaultLanguage, 26 }), 27 ] 28 }, 29 })