Skip to content

Commit

Permalink
Merge branch 'ChatGPTNextWeb:main' into upload_doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Dakai authored Oct 6, 2024
2 parents e6ef10e + 2bac174 commit 32045e9
Showing 1 changed file with 1 addition and 18 deletions.
19 changes: 1 addition & 18 deletions app/components/markdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -207,23 +207,6 @@ function CustomCode(props: { children: any; className?: string }) {
);
}

function escapeDollarNumber(text: string) {
let escapedText = "";

for (let i = 0; i < text.length; i += 1) {
let char = text[i];
const nextChar = text[i + 1] || " ";

if (char === "$" && nextChar >= "0" && nextChar <= "9") {
char = "\\$";
}

escapedText += char;
}

return escapedText;
}

function escapeBrackets(text: string) {
const pattern =
/(```[\s\S]*?```|`.*?`)|\\\[([\s\S]*?[^\\])\\\]|\\\((.*?)\\\)/g;
Expand Down Expand Up @@ -261,7 +244,7 @@ function tryWrapHtmlCode(text: string) {

function _MarkDownContent(props: { content: string }) {
const escapedContent = useMemo(() => {
return tryWrapHtmlCode(escapeBrackets(escapeDollarNumber(props.content)));
return tryWrapHtmlCode(escapeBrackets(props.content));
}, [props.content]);

return (
Expand Down

0 comments on commit 32045e9

Please sign in to comment.