mirror of
https://github.com/elk-zone/elk.git
synced 2024-12-05 03:59:59 +03:00
320ddc0e28
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: TAKAHASHI Shuuji <shuuji3@gmail.com>
25 lines
649 B
TypeScript
25 lines
649 B
TypeScript
import CodeBlock from '@tiptap/extension-code-block'
|
|
import { VueNodeViewRenderer } from '@tiptap/vue-3'
|
|
|
|
import { createHighlightPlugin } from 'prosemirror-highlight'
|
|
import TiptapCodeBlock from '~/components/tiptap/TiptapCodeBlock.vue'
|
|
import { shikiParser } from './shiki-parser'
|
|
|
|
export const TiptapPluginCodeBlockShiki = CodeBlock.extend({
|
|
addOptions() {
|
|
return {
|
|
...this.parent?.(),
|
|
defaultLanguage: null,
|
|
}
|
|
},
|
|
|
|
addProseMirrorPlugins() {
|
|
return [
|
|
createHighlightPlugin({ parser: shikiParser, nodeTypes: ['codeBlock'] }),
|
|
]
|
|
},
|
|
|
|
addNodeView() {
|
|
return VueNodeViewRenderer(TiptapCodeBlock)
|
|
},
|
|
})
|