mirror of https://github.com/usememos/memos
feat: add `escape` to renderer
parent
ea911387f1
commit
486cf8bdac
@ -0,0 +1,18 @@
|
|||||||
|
import { escape } from "lodash-es";
|
||||||
|
|
||||||
|
export const PLAIN_TEXT_REG = /([\S ]+)/;
|
||||||
|
|
||||||
|
const renderer = (rawStr: string): string => {
|
||||||
|
const matchResult = rawStr.match(PLAIN_TEXT_REG);
|
||||||
|
if (!matchResult) {
|
||||||
|
return rawStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
return `${escape(matchResult[1])}`;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "plain text",
|
||||||
|
regex: PLAIN_TEXT_REG,
|
||||||
|
renderer,
|
||||||
|
};
|
Loading…
Reference in New Issue