mirror of https://github.com/usememos/memos
feat: add blockquote regexp (#366)
parent
43541bde2c
commit
7c401040c8
@ -0,0 +1,18 @@
|
|||||||
|
import { escape } from "lodash";
|
||||||
|
|
||||||
|
export const BLOCKQUOTE_REG = /> ([\S ]+)(\n?)/;
|
||||||
|
|
||||||
|
const renderer = (rawStr: string): string => {
|
||||||
|
const matchResult = rawStr.match(BLOCKQUOTE_REG);
|
||||||
|
if (!matchResult) {
|
||||||
|
return rawStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
return `<blockquote>${escape(matchResult[1])}</blockquote>${matchResult[2]}`;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "blockqoute",
|
||||||
|
regex: BLOCKQUOTE_REG,
|
||||||
|
renderer,
|
||||||
|
};
|
Loading…
Reference in New Issue