import { inputRules, textblockTypeInputRule, wrappingInputRule } from "prosemirror-inputrules"; import { schema } from "prosemirror-markdown"; export const headingRule = textblockTypeInputRule( /^(#{1,6})\s$/, schema.nodes.heading, match => ({ level: match[1]!.length }) ); export const blockquoteRule = wrappingInputRule( /^\>\s$/, schema.nodes.blockquote ); export const unorderedListRule = wrappingInputRule( /^\-\s$/, schema.nodes.bullet_list ); export const orderedListRule = wrappingInputRule( /^1\.\s$/, schema.nodes.ordered_list ); export const rules = inputRules({ rules: [ headingRule, blockquoteRule, unorderedListRule, orderedListRule, ], });