refactor: migrate from shikiji to shiki v1 (#2591)
This commit is contained in:
parent
40415f34a4
commit
8eb6b2378a
8 changed files with 37 additions and 37 deletions
25
composables/tiptap/shiki.ts
Normal file
25
composables/tiptap/shiki.ts
Normal file
|
@ -0,0 +1,25 @@
|
|||
import CodeBlock from '@tiptap/extension-code-block'
|
||||
import { VueNodeViewRenderer } from '@tiptap/vue-3'
|
||||
|
||||
import { createHighlightPlugin } from 'prosemirror-highlight'
|
||||
import { shikiParser } from './shiki-parser'
|
||||
import TiptapCodeBlock from '~/components/tiptap/TiptapCodeBlock.vue'
|
||||
|
||||
export const TiptapPluginCodeBlockShiki = CodeBlock.extend({
|
||||
addOptions() {
|
||||
return {
|
||||
...this.parent?.(),
|
||||
defaultLanguage: null,
|
||||
}
|
||||
},
|
||||
|
||||
addProseMirrorPlugins() {
|
||||
return [
|
||||
createHighlightPlugin({ parser: shikiParser, nodeTypes: ['codeBlock'] }),
|
||||
]
|
||||
},
|
||||
|
||||
addNodeView() {
|
||||
return VueNodeViewRenderer(TiptapCodeBlock)
|
||||
},
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue