mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-17 22:39:56 +02:00
Extracted out the commonly used line break regex
This commit extract the commonly used /br\s*\/?>/gi regex to common.js, in order to keep the code more DRY.
This commit is contained in:
@@ -25,8 +25,10 @@ export const sanitizeText = (text, config) => {
|
||||
return txt;
|
||||
};
|
||||
|
||||
export const lineBreakRegex = /<br\s*\/?>/gi;
|
||||
|
||||
const breakToPlaceholder = s => {
|
||||
return s.replace(/<br\s*\/?>/gi, '#br#');
|
||||
return s.replace(lineBreakRegex, '#br#');
|
||||
};
|
||||
|
||||
const placeholderToBreak = s => {
|
||||
@@ -35,5 +37,6 @@ const placeholderToBreak = s => {
|
||||
|
||||
export default {
|
||||
getRows,
|
||||
sanitizeText
|
||||
sanitizeText,
|
||||
lineBreakRegex
|
||||
};
|
||||
|
Reference in New Issue
Block a user