mirror of
https://github.com/usememos/memos.git
synced 2025-01-03 03:38:23 +03:00
chore: remove escape (#918)
This commit is contained in:
parent
771c56f485
commit
1847756ade
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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} />;
|
||||
};
|
||||
|
||||
|
@ -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 {
|
||||
|
@ -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>
|
||||
);
|
||||
|
@ -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>
|
||||
);
|
||||
};
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user