How rules work in simple-markdown
masterIn simple-markdown, elements are created from rules. A rule is an object that defines how to identify, parse, and render a specific markdown pattern.
To create a custom extension, you must define a rule object with the following lifecycle methods:
match(source, state): Determines if the currentsourcematches the rule. It should return acaptureobject (like the result ofRegExp.exec) if successful, ornullif not. Note: Regexes used inmatchshould always begin with^to avoid infinite loops.parse(capture, recurseParse, state): Transforms thecaptureinto a syntax tree node. It usesrecurseParseto handle nested content.react(node, recurseOutput, state)ORhtml(node, recurseOutput, state): Transforms the syntax node into the final output format. You typically implement one or the other depending on whether you are building a React or HTML outputter.