mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-12-04 11:49:02 +08:00
This commit is contained in:
parent
c106a39887
commit
f79c05edd4
5
.changeset/famous-bags-breathe.md
Normal file
5
.changeset/famous-bags-breathe.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@tiptap/extension-code": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Update inline code formatting for text enclosed in backticks
|
@ -34,14 +34,20 @@ declare module '@tiptap/core' {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Matches inline code.
|
* Regular expressions to match inline code blocks enclosed in backticks.
|
||||||
|
* It matches:
|
||||||
|
* - An opening backtick, followed by
|
||||||
|
* - Any text that doesn't include a backtick (captured for marking), followed by
|
||||||
|
* - A closing backtick.
|
||||||
|
* This ensures that any text between backticks is formatted as code,
|
||||||
|
* regardless of the surrounding characters (exception being another backtick).
|
||||||
*/
|
*/
|
||||||
export const inputRegex = /(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))$/
|
export const inputRegex = /(?<!`)`([^`]+)`(?!`)/;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Matches inline code while pasting.
|
* Matches inline code while pasting.
|
||||||
*/
|
*/
|
||||||
export const pasteRegex = /(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))/g
|
export const pasteRegex = /(?<!`)`([^`]+)`(?!`)/g;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This extension allows you to mark text as inline code.
|
* This extension allows you to mark text as inline code.
|
||||||
|
Loading…
Reference in New Issue
Block a user