tiptap/packages/extension-code-block-lowlight/src/code-block-lowlight.ts

25 lines
634 B
TypeScript
Raw Normal View History

import lowlight from 'lowlight/lib/core'
import CodeBlock, { CodeBlockOptions } from '@tiptap/extension-code-block'
2021-04-02 06:07:40 +08:00
import { LowlightPlugin } from './lowlight-plugin'
export interface CodeBlockLowlightOptions extends CodeBlockOptions {
lowlight: any,
}
export const CodeBlockLowlight = CodeBlock.extend<CodeBlockLowlightOptions>({
defaultOptions: {
...CodeBlock.config.defaultOptions,
lowlight,
},
2021-04-02 06:07:40 +08:00
addProseMirrorPlugins() {
return [
2021-04-14 15:48:38 +08:00
// ...this.parentConfig.addProseMirrorPlugins?.() || [],
LowlightPlugin({
name: 'codeBlock',
lowlight: this.options.lowlight,
}),
2021-04-02 06:07:40 +08:00
]
},
})