feat: add blockquote regexp (#366)

pull/367/head
boojack 3 years ago committed by GitHub
parent 43541bde2c
commit 7c401040c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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

@ -15,6 +15,7 @@ import InlineCode from "./InlineCode";
import PlainText from "./PlainText";
import Table from "./Table";
import BoldEmphasis from "./BoldEmphasis";
import Blockquote from "./Blockquote";
export { CODE_BLOCK_REG } from "./CodeBlock";
export { TODO_LIST_REG } from "./TodoList";
@ -26,6 +27,6 @@ export { MARK_REG } from "./Mark";
export { TABLE_REG } from "./Table";
// The order determines the order of execution.
export const blockElementParserList = [Table, CodeBlock, TodoList, DoneList, OrderedList, UnorderedList, Paragraph];
export const blockElementParserList = [Table, CodeBlock, Blockquote, TodoList, DoneList, OrderedList, UnorderedList, Paragraph];
export const inlineElementParserList = [Image, Mark, BoldEmphasis, Bold, Emphasis, Link, InlineCode, PlainLink, Tag, PlainText];
export const parserList = [...blockElementParserList, ...inlineElementParserList];

@ -77,6 +77,10 @@
@apply px-4 py-1 text-center border border-gray-300;
}
}
blockquote {
@apply border-l-4 pl-2 text-gray-400;
}
}
> .expand-btn-container {

Loading…
Cancel
Save