diff --git a/packages/extension-bold/src/bold.ts b/packages/extension-bold/src/bold.ts index 94555cd0a1c..1ded5189a28 100644 --- a/packages/extension-bold/src/bold.ts +++ b/packages/extension-bold/src/bold.ts @@ -28,10 +28,10 @@ declare module '@tiptap/core' { } } -export const starInputRegex = /(?:^|\s)((?:\*\*)((?:[^*]+))(?:\*\*))$/ -export const starPasteRegex = /(?:^|\s)((?:\*\*)((?:[^*]+))(?:\*\*))/g -export const underscoreInputRegex = /(?:^|\s)((?:__)((?:[^__]+))(?:__))$/ -export const underscorePasteRegex = /(?:^|\s)((?:__)((?:[^__]+))(?:__))/g +export const starInputRegex = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/ +export const starPasteRegex = /(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g +export const underscoreInputRegex = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/ +export const underscorePasteRegex = /(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g export const Bold = Mark.create({ name: 'bold', diff --git a/packages/extension-code/src/code.ts b/packages/extension-code/src/code.ts index be1203cf907..9b7ce724a72 100644 --- a/packages/extension-code/src/code.ts +++ b/packages/extension-code/src/code.ts @@ -28,8 +28,8 @@ declare module '@tiptap/core' { } } -export const inputRegex = /(?:^|\s)((?:`)((?:[^`]+))(?:`))$/ -export const pasteRegex = /(?:^|\s)((?:`)((?:[^`]+))(?:`))/g +export const inputRegex = /(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))$/ +export const pasteRegex = /(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))/g export const Code = Mark.create({ name: 'code', diff --git a/packages/extension-highlight/src/highlight.ts b/packages/extension-highlight/src/highlight.ts index a682bda0813..89c806a6a15 100644 --- a/packages/extension-highlight/src/highlight.ts +++ b/packages/extension-highlight/src/highlight.ts @@ -29,8 +29,8 @@ declare module '@tiptap/core' { } } -export const inputRegex = /(?:^|\s)((?:==)((?:[^~=]+))(?:==))$/ -export const pasteRegex = /(?:^|\s)((?:==)((?:[^~=]+))(?:==))/g +export const inputRegex = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/ +export const pasteRegex = /(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g export const Highlight = Mark.create({ name: 'highlight', diff --git a/packages/extension-italic/src/italic.ts b/packages/extension-italic/src/italic.ts index ce98b9678ec..2e807404dd4 100644 --- a/packages/extension-italic/src/italic.ts +++ b/packages/extension-italic/src/italic.ts @@ -28,10 +28,10 @@ declare module '@tiptap/core' { } } -export const starInputRegex = /(?:^|\s)((?:\*)((?:[^*]+))(?:\*))$/ -export const starPasteRegex = /(?:^|\s)((?:\*)((?:[^*]+))(?:\*))/g -export const underscoreInputRegex = /(?:^|\s)((?:_)((?:[^_]+))(?:_))$/ -export const underscorePasteRegex = /(?:^|\s)((?:_)((?:[^_]+))(?:_))/g +export const starInputRegex = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/ +export const starPasteRegex = /(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g +export const underscoreInputRegex = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/ +export const underscorePasteRegex = /(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g export const Italic = Mark.create({ name: 'italic', diff --git a/packages/extension-strike/src/strike.ts b/packages/extension-strike/src/strike.ts index 14be97640a7..d26fab68918 100644 --- a/packages/extension-strike/src/strike.ts +++ b/packages/extension-strike/src/strike.ts @@ -29,8 +29,8 @@ declare module '@tiptap/core' { } } -export const inputRegex = /(?:^|\s)((?:~~)((?:[^~]+))(?:~~))$/ -export const pasteRegex = /(?:^|\s)((?:~~)((?:[^~]+))(?:~~))/g +export const inputRegex = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/ +export const pasteRegex = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g export const Strike = Mark.create({ name: 'strike',