You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
memos/web/src/labs/marked/parser/Blockquote.ts

19 lines
392 B
TypeScript

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,
};