Skip to content

Commit

Permalink
Forbid **bold** in headings
Browse files Browse the repository at this point in the history
  • Loading branch information
neongreen committed Jun 18, 2023
1 parent 74ef092 commit 0e09672
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions components/tiptap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import TurndownService from 'turndown'
import { TiptapBubbleMenu } from './tiptapBubbleMenu'
import styles from './tiptap.module.scss'
import HorizontalRule from '@tiptap/extension-horizontal-rule'
import Heading from '@tiptap/extension-heading'

const turndownService = new TurndownService({
headingStyle: 'atx', // # headers
Expand Down Expand Up @@ -146,9 +147,13 @@ let Tiptap = forwardRef(
const editor = useEditor({
extensions: [
StarterKit.configure({
heading: { levels: [1, 2, 3] },
horizontalRule: false,
heading: false,
}),
Heading.extend({
// Forbid bold from appearing in headings. The full list of available marks can be fetched with:
// rg -l 'Mark.create' tiptap/packages/ | xargs rg 'name:'
marks: 'italic code strike link',
}).configure({ levels: [1, 2, 3] }),
Typography,
LinkWithDialog.configure({
onLinkCommand: () => setLinkDialogOpen(true),
Expand All @@ -158,7 +163,6 @@ let Tiptap = forwardRef(
},
}),
TrailingNode,
HorizontalRule,
SubmitShortcut.configure({ onSubmit: props.onSubmit }),
],
editorProps: {
Expand Down

0 comments on commit 0e09672

Please sign in to comment.