Skip to content

Commit

Permalink
feat: markdown pasting support
Browse files Browse the repository at this point in the history
  • Loading branch information
kane50613 committed May 21, 2024
1 parent 779dedb commit 677819a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"swr": "^2.2.5",
"tailwind-merge": "^2.3.0",
"tailwindcss-animate": "^1.0.7",
"tiptap-markdown": "^0.8.10",
"xss": "^1.0.15",
"zod": "^3.23.8",
"zod-form-data": "^2.0.2",
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions src/components/ui/editor/novel-extensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
} from "novel/extensions";

import { cx } from "class-variance-authority";
import { Markdown } from "tiptap-markdown";

const tiptapLink = TiptapLink.configure({
HTMLAttributes: {
Expand Down Expand Up @@ -83,11 +84,19 @@ const starterKit = StarterKit.configure({
gapcursor: false,
});

const markdown = Markdown.configure({
// for safety reasons, we don't want to allow raw HTML
html: false,
transformCopiedText: true,
transformPastedText: true,
});

export const defaultExtensions = [
starterKit,
Placeholder,
tiptapLink,
taskList,
taskItem,
tiptapImage,
markdown,
];

0 comments on commit 677819a

Please sign in to comment.