Edit markdown content in tiptap v3 editor.
npm install @sequa-ai/tiptap-markdown
> This is a fork from tiptap-markdown. The peer dependencies have been updated to support Tiptap v3.
The markdown extension for Tiptap editor.
``bash`
npm install tiptap-markdown
`js
import { Editor } from '@tiptap/core';
import StarterKit from '@tiptap/starter-kit';
import { Markdown } from 'tiptap-markdown';
const editor = new Editor({
content: "# Title",
extensions: [
StarterKit,
Markdown,
],
});
const markdownOutput = editor.storage.markdown.getMarkdown();
`
js
Markdown.configure({
html: true, // Allow HTML input/output
tightLists: true, // No inside
in markdown output
tightListClass: 'tight', // Add class to allowing you to remove margins when tight
bulletListMarker: '-', //
- prefix in markdown output
linkify: false, // Create links from "https://..." text
breaks: false, // New lines (\n) in markdown input are converted to
transformPastedText: false, // Allow to paste markdown text in the editor
transformCopiedText: false, // Copied text is transformed to markdown
})
`$3
`js
editor.commands.setContent('test') // setContent supports markdown format
editor.storage.markdown.getMarkdown(); // get current content as markdown
``Please make sure to update tests as appropriate.