Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

chore: remove escape (#918)

boojack1847756ade10
diff --git a/web/src/labs/marked/parser/Blockquote.tsx b/web/src/labs/marked/parser/Blockquote.tsx
index da4d02c7e..5d1daf483 100644
--- a/web/src/labs/marked/parser/Blockquote.tsx
+++ b/web/src/labs/marked/parser/Blockquote.tsx
@@ -1,4 +1,3 @@
-import { escape } from "lodash";
import { matcher } from "../matcher";
export const BLOCKQUOTE_REG = /^> ([^\n]+)/;
@@ -9,7 +8,7 @@ const renderer = (rawStr: string) => {
return <>{rawStr}</>;
}
- return <blockquote>{escape(matchResult[1])}</blockquote>;
+ return <blockquote>{matchResult[1]}</blockquote>;
};
export default {
diff --git a/web/src/labs/marked/parser/CodeBlock.tsx b/web/src/labs/marked/parser/CodeBlock.tsx
index e3c4be457..231033ca4 100644
--- a/web/src/labs/marked/parser/CodeBlock.tsx
+++ b/web/src/labs/marked/parser/CodeBlock.tsx
@@ -1,5 +1,4 @@
import copy from "copy-to-clipboard";
-import { escape } from "lodash-es";
import hljs from "highlight.js";
import { useTranslation } from "react-i18next";
import { matcher } from "../matcher";
@@ -14,7 +13,7 @@ const renderer = (rawStr: string) => {
return <>{rawStr}</>;
}
- const language = escape(matchResult[1]) || "plaintext";
+ const language = matchResult[1] || "plaintext";
let highlightedCode = hljs.highlightAuto(matchResult[2]).value;
try {
diff --git a/web/src/labs/marked/parser/Heading.tsx b/web/src/labs/marked/parser/Heading.tsx
index 82308e4b7..aadfa4089 100644
--- a/web/src/labs/marked/parser/Heading.tsx
+++ b/web/src/labs/marked/parser/Heading.tsx
@@ -1,4 +1,3 @@
-import { escape } from "lodash";
import { matcher } from "../matcher";
export const HEADING_REG = /^(#+) ([^\n]+)/;
@@ -11,15 +10,15 @@ const renderer = (rawStr: string) => {
const level = matchResult[1].length;
if (level === 1) {
- return <h1>{escape(matchResult[2])}</h1>;
+ return <h1>{matchResult[2]}</h1>;
} else if (level === 2) {
- return <h2>{escape(matchResult[2])}</h2>;
+ return <h2>{matchResult[2]}</h2>;
} else if (level === 3) {
- return <h3>{escape(matchResult[2])}</h3>;
+ return <h3>{matchResult[2]}</h3>;
} else if (level === 4) {
- return <h4>{escape(matchResult[2])}</h4>;
+ return <h4>{matchResult[2]}</h4>;
}
- return <h5>{escape(matchResult[2])}</h5>;
+ return <h5>{matchResult[2]}</h5>;
};
export default {
diff --git a/web/src/labs/marked/parser/Image.tsx b/web/src/labs/marked/parser/Image.tsx
index 81052a3ed..b9dc835e0 100644
--- a/web/src/labs/marked/parser/Image.tsx
+++ b/web/src/labs/marked/parser/Image.tsx
@@ -1,4 +1,3 @@
-import { escape } from "lodash-es";
import { absolutifyLink } from "../../../helpers/utils";
import { matcher } from "../matcher";
@@ -10,7 +9,7 @@ const renderer = (rawStr: string) => {
return rawStr;
}
- const imageUrl = absolutifyLink(escape(matchResult[1]));
+ const imageUrl = absolutifyLink(matchResult[1]);
return <img className="img" src={imageUrl} />;
};
diff --git a/web/src/labs/marked/parser/InlineCode.tsx b/web/src/labs/marked/parser/InlineCode.tsx
index 0c7c90d3f..ebc841742 100644
--- a/web/src/labs/marked/parser/InlineCode.tsx
+++ b/web/src/labs/marked/parser/InlineCode.tsx
@@ -1,4 +1,3 @@
-import { escape } from "lodash-es";
import { matcher } from "../matcher";
export const INLINE_CODE_REG = /`(.+?)`/;
@@ -9,7 +8,7 @@ const renderer = (rawStr: string) => {
return rawStr;
}
- return <code>{escape(matchResult[1])}</code>;
+ return <code>{matchResult[1]}</code>;
};
export default {
diff --git a/web/src/labs/marked/parser/Link.tsx b/web/src/labs/marked/parser/Link.tsx
index 3ff7ada09..b7ea90b04 100644
--- a/web/src/labs/marked/parser/Link.tsx
+++ b/web/src/labs/marked/parser/Link.tsx
@@ -1,4 +1,3 @@
-import { escape } from "lodash-es";
import Emphasis from "./Emphasis";
import Bold from "./Bold";
import { marked } from "..";
@@ -16,7 +15,7 @@ const renderer = (rawStr: string) => {
}
const parsedContent = marked(matchResult[1], [], [InlineCode, BoldEmphasis, Emphasis, Bold, PlainText]);
return (
- <a className="link" target="_blank" rel="noreferrer" href={escape(matchResult[2])}>
+ <a className="link" target="_blank" rel="noreferrer" href={matchResult[2]}>
{parsedContent}
</a>
);
diff --git a/web/src/labs/marked/parser/PlainLink.tsx b/web/src/labs/marked/parser/PlainLink.tsx
index f420fbe47..c754ee7db 100644
--- a/web/src/labs/marked/parser/PlainLink.tsx
+++ b/web/src/labs/marked/parser/PlainLink.tsx
@@ -1,4 +1,3 @@
-import { escape } from "lodash-es";
import { matcher } from "../matcher";
export const PLAIN_LINK_REG = /(https?:\/\/[^ ]+)/;
@@ -10,8 +9,8 @@ const renderer = (rawStr: string) => {
}
return (
- <a className="link" target="_blank" rel="noreferrer" href={escape(matchResult[1])}>
- {escape(matchResult[1])}
+ <a className="link" target="_blank" rel="noreferrer" href={matchResult[1]}>
+ {matchResult[1]}
</a>
);
};
diff --git a/web/src/labs/marked/parser/PlainText.tsx b/web/src/labs/marked/parser/PlainText.tsx
index 498c7b50a..41c45de51 100644
--- a/web/src/labs/marked/parser/PlainText.tsx
+++ b/web/src/labs/marked/parser/PlainText.tsx
@@ -1,4 +1,3 @@
-import { escape } from "lodash-es";
import { matcher } from "../matcher";
export const PLAIN_TEXT_REG = /(.+)/;
@@ -9,7 +8,7 @@ const renderer = (rawStr: string): string => {
return rawStr;
}
- return `${escape(matchResult[1])}`;
+ return matchResult[1];
};
export default {
diff --git a/web/src/labs/marked/parser/Strikethrough.tsx b/web/src/labs/marked/parser/Strikethrough.tsx
index 5b0cb98b4..64d8d0b28 100644
--- a/web/src/labs/marked/parser/Strikethrough.tsx
+++ b/web/src/labs/marked/parser/Strikethrough.tsx
@@ -1,4 +1,3 @@
-import { escape } from "lodash";
import { matcher } from "../matcher";
export const STRIKETHROUGH_REG = /~~(.+?)~~/;
@@ -9,7 +8,7 @@ const renderer = (rawStr: string) => {
return rawStr;
}
- return <del>{escape(matchResult[1])}</del>;
+ return <del>{matchResult[1]}</del>;
};
export default {
diff --git a/web/src/labs/marked/parser/Tag.tsx b/web/src/labs/marked/parser/Tag.tsx
index b7f1b5fb2..5e74b5f42 100644
--- a/web/src/labs/marked/parser/Tag.tsx
+++ b/web/src/labs/marked/parser/Tag.tsx
@@ -1,4 +1,3 @@
-import { escape } from "lodash-es";
import { matcher } from "../matcher";
export const TAG_REG = /#([^\s#]+)/;
@@ -9,7 +8,7 @@ const renderer = (rawStr: string) => {
return rawStr;
}
- return <span className="tag-span">#{escape(matchResult[1])}</span>;
+ return <span className="tag-span">#{matchResult[1]}</span>;
};
export default {