Skip to content

bugfix: Delete the escapeDollarNumber function, which causes errors i… #4393

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 6, 2024
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
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
Loading