Skip to content

Latest commit

 

History

History
70 lines (60 loc) · 1.26 KB

migration.md

File metadata and controls

70 lines (60 loc) · 1.26 KB

Migrate to 0.7.0

Simple

import { Editor } from '@tiptap/core'
- import { createMarkdownEditor } from 'tiptap-markdown'
+ import { Markdown } from 'tiptap-markdown'

- const MarkdownEditor = createMarkdownEditor(Editor)
- const editor = new MarkdownEditor({
+ const editor = new Editor({
   extensions: [
+    Markdown,
   ],
})

With options

const editor = new Editor({
   extensions: [
+    Markdown.configure({
+      breaks: true,
+    })
   ],
-  markdown: {
-    breaks: true,
-  },
})

Advanced: Custom extension

createMarkdownExtension() has been dropped in favor Tiptap extension addStorage(). Existing Tiptap node/mark can be configured by using addStorage() in Node.extend({ ... })

See example
- import { createMarkdownExtension } from 'tiptap-markdown'

const CustomNode = Node.create({
+  addStorage() {
+    return {
+      markdown: {
+        serialize() {},
+        parse: {},
+      }
+    }
+  }
})


new Editor({
  extensions: [
    CustomNode,
  ]
-  markdown: {
-    extensions: [
-      createMarkdownExtension(CustomNode, {
-        serialize() {},
-        parse: {},
-      })
-    ]
-  }
})