mirror of
https://github.com/usememos/memos.git
synced 2025-01-06 23:36:31 +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";
|
import { matcher } from "../matcher";
|
||||||
|
|
||||||
export const BLOCKQUOTE_REG = /^> ([^\n]+)/;
|
export const BLOCKQUOTE_REG = /^> ([^\n]+)/;
|
||||||
@ -9,7 +8,7 @@ const renderer = (rawStr: string) => {
|
|||||||
return <>{rawStr}</>;
|
return <>{rawStr}</>;
|
||||||
}
|
}
|
||||||
|
|
||||||
return <blockquote>{escape(matchResult[1])}</blockquote>;
|
return <blockquote>{matchResult[1]}</blockquote>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import copy from "copy-to-clipboard";
|
import copy from "copy-to-clipboard";
|
||||||
import { escape } from "lodash-es";
|
|
||||||
import hljs from "highlight.js";
|
import hljs from "highlight.js";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { matcher } from "../matcher";
|
import { matcher } from "../matcher";
|
||||||
@ -14,7 +13,7 @@ const renderer = (rawStr: string) => {
|
|||||||
return <>{rawStr}</>;
|
return <>{rawStr}</>;
|
||||||
}
|
}
|
||||||
|
|
||||||
const language = escape(matchResult[1]) || "plaintext";
|
const language = matchResult[1] || "plaintext";
|
||||||
let highlightedCode = hljs.highlightAuto(matchResult[2]).value;
|
let highlightedCode = hljs.highlightAuto(matchResult[2]).value;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import { escape } from "lodash";
|
|
||||||
import { matcher } from "../matcher";
|
import { matcher } from "../matcher";
|
||||||
|
|
||||||
export const HEADING_REG = /^(#+) ([^\n]+)/;
|
export const HEADING_REG = /^(#+) ([^\n]+)/;
|
||||||
@ -11,15 +10,15 @@ const renderer = (rawStr: string) => {
|
|||||||
|
|
||||||
const level = matchResult[1].length;
|
const level = matchResult[1].length;
|
||||||
if (level === 1) {
|
if (level === 1) {
|
||||||
return <h1>{escape(matchResult[2])}</h1>;
|
return <h1>{matchResult[2]}</h1>;
|
||||||
} else if (level === 2) {
|
} else if (level === 2) {
|
||||||
return <h2>{escape(matchResult[2])}</h2>;
|
return <h2>{matchResult[2]}</h2>;
|
||||||
} else if (level === 3) {
|
} else if (level === 3) {
|
||||||
return <h3>{escape(matchResult[2])}</h3>;
|
return <h3>{matchResult[2]}</h3>;
|
||||||
} else if (level === 4) {
|
} 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 {
|
export default {
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import { escape } from "lodash-es";
|
|
||||||
import { absolutifyLink } from "../../../helpers/utils";
|
import { absolutifyLink } from "../../../helpers/utils";
|
||||||
import { matcher } from "../matcher";
|
import { matcher } from "../matcher";
|
||||||
|
|
||||||
@ -10,7 +9,7 @@ const renderer = (rawStr: string) => {
|
|||||||
return rawStr;
|
return rawStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
const imageUrl = absolutifyLink(escape(matchResult[1]));
|
const imageUrl = absolutifyLink(matchResult[1]);
|
||||||
return <img className="img" src={imageUrl} />;
|
return <img className="img" src={imageUrl} />;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import { escape } from "lodash-es";
|
|
||||||
import { matcher } from "../matcher";
|
import { matcher } from "../matcher";
|
||||||
|
|
||||||
export const INLINE_CODE_REG = /`(.+?)`/;
|
export const INLINE_CODE_REG = /`(.+?)`/;
|
||||||
@ -9,7 +8,7 @@ const renderer = (rawStr: string) => {
|
|||||||
return rawStr;
|
return rawStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return <code>{escape(matchResult[1])}</code>;
|
return <code>{matchResult[1]}</code>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import { escape } from "lodash-es";
|
|
||||||
import Emphasis from "./Emphasis";
|
import Emphasis from "./Emphasis";
|
||||||
import Bold from "./Bold";
|
import Bold from "./Bold";
|
||||||
import { marked } from "..";
|
import { marked } from "..";
|
||||||
@ -16,7 +15,7 @@ const renderer = (rawStr: string) => {
|
|||||||
}
|
}
|
||||||
const parsedContent = marked(matchResult[1], [], [InlineCode, BoldEmphasis, Emphasis, Bold, PlainText]);
|
const parsedContent = marked(matchResult[1], [], [InlineCode, BoldEmphasis, Emphasis, Bold, PlainText]);
|
||||||
return (
|
return (
|
||||||
<a className="link" target="_blank" rel="noreferrer" href={escape(matchResult[2])}>
|
<a className="link" target="_blank" rel="noreferrer" href={matchResult[2]}>
|
||||||
{parsedContent}
|
{parsedContent}
|
||||||
</a>
|
</a>
|
||||||
);
|
);
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import { escape } from "lodash-es";
|
|
||||||
import { matcher } from "../matcher";
|
import { matcher } from "../matcher";
|
||||||
|
|
||||||
export const PLAIN_LINK_REG = /(https?:\/\/[^ ]+)/;
|
export const PLAIN_LINK_REG = /(https?:\/\/[^ ]+)/;
|
||||||
@ -10,8 +9,8 @@ const renderer = (rawStr: string) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<a className="link" target="_blank" rel="noreferrer" href={escape(matchResult[1])}>
|
<a className="link" target="_blank" rel="noreferrer" href={matchResult[1]}>
|
||||||
{escape(matchResult[1])}
|
{matchResult[1]}
|
||||||
</a>
|
</a>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import { escape } from "lodash-es";
|
|
||||||
import { matcher } from "../matcher";
|
import { matcher } from "../matcher";
|
||||||
|
|
||||||
export const PLAIN_TEXT_REG = /(.+)/;
|
export const PLAIN_TEXT_REG = /(.+)/;
|
||||||
@ -9,7 +8,7 @@ const renderer = (rawStr: string): string => {
|
|||||||
return rawStr;
|
return rawStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return `${escape(matchResult[1])}`;
|
return matchResult[1];
|
||||||
};
|
};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import { escape } from "lodash";
|
|
||||||
import { matcher } from "../matcher";
|
import { matcher } from "../matcher";
|
||||||
|
|
||||||
export const STRIKETHROUGH_REG = /~~(.+?)~~/;
|
export const STRIKETHROUGH_REG = /~~(.+?)~~/;
|
||||||
@ -9,7 +8,7 @@ const renderer = (rawStr: string) => {
|
|||||||
return rawStr;
|
return rawStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return <del>{escape(matchResult[1])}</del>;
|
return <del>{matchResult[1]}</del>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
import { escape } from "lodash-es";
|
|
||||||
import { matcher } from "../matcher";
|
import { matcher } from "../matcher";
|
||||||
|
|
||||||
export const TAG_REG = /#([^\s#]+)/;
|
export const TAG_REG = /#([^\s#]+)/;
|
||||||
@ -9,7 +8,7 @@ const renderer = (rawStr: string) => {
|
|||||||
return rawStr;
|
return rawStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return <span className="tag-span">#{escape(matchResult[1])}</span>;
|
return <span className="tag-span">#{matchResult[1]}</span>;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
Loading…
Reference in New Issue
Block a user