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
|
@ -1,9 +1,9 @@
|
|||
import { type Parser, createParser } from 'prosemirror-highlight/shikiji'
|
||||
import type { BuiltinLanguage } from 'shikiji/langs'
|
||||
import { type Parser, createParser } from 'prosemirror-highlight/shiki'
|
||||
import type { BuiltinLanguage } from 'shiki'
|
||||
|
||||
let parser: Parser | undefined
|
||||
|
||||
export const shikijiParser: Parser = (options) => {
|
||||
export const shikiParser: Parser = (options) => {
|
||||
const lang = options.language ?? 'text'
|
||||
|
||||
// Register the language if it's not yet registered
|
|
@ -2,10 +2,10 @@ import CodeBlock from '@tiptap/extension-code-block'
|
|||
import { VueNodeViewRenderer } from '@tiptap/vue-3'
|
||||
|
||||
import { createHighlightPlugin } from 'prosemirror-highlight'
|
||||
import { shikijiParser } from './shikiji-parser'
|
||||
import { shikiParser } from './shiki-parser'
|
||||
import TiptapCodeBlock from '~/components/tiptap/TiptapCodeBlock.vue'
|
||||
|
||||
export const TiptapPluginCodeBlockShikiji = CodeBlock.extend({
|
||||
export const TiptapPluginCodeBlockShiki = CodeBlock.extend({
|
||||
addOptions() {
|
||||
return {
|
||||
...this.parent?.(),
|
||||
|
@ -15,7 +15,7 @@ export const TiptapPluginCodeBlockShikiji = CodeBlock.extend({
|
|||
|
||||
addProseMirrorPlugins() {
|
||||
return [
|
||||
createHighlightPlugin({ parser: shikijiParser, nodeTypes: ['codeBlock'] }),
|
||||
createHighlightPlugin({ parser: shikiParser, nodeTypes: ['codeBlock'] }),
|
||||
]
|
||||
},
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue