Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/utils/components/markdown/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ const fixMarkTagForMarkdown = (input: string): string => {
return result;
};

const handleDolarSign = (input: string): string => {
// Only escape $ when it's followed by a number and not already escaped (not preceded by a backslash)
// Match $100, $1,000.50, etc., but not already escaped \$100
return input.replace(/(?<!\\)(\$)(\d[\d,]*(?:\.\d+)?)/g, "\\$1$2");
};

//TODO: Fix lookbehind ?<= regular expression, because it not works on safari
// const getRegexBetween = (
// openChart: string,
Expand Down Expand Up @@ -86,6 +92,7 @@ export const fixContentForMarkdown = (content = ""): string => {
trimContentForMarkdown,
fixInlineStylesSyntaxForMarkdown,
fixMarkTagForMarkdown,
handleDolarSign,
// fixUnderlineForMarkdown,
// fixNoticeForMarkdown,
])(content);
Expand Down
Loading