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/Strikethrough.tsx

20 lines
398 B
TypeScript

import { escape } from "lodash";
import { matcher } from "../matcher";
export const STRIKETHROUGH_REG = /~~(.+?)~~/;
const renderer = (rawStr: string) => {
const matchResult = matcher(rawStr, STRIKETHROUGH_REG);
if (!matchResult) {
return rawStr;
}
return <del>{escape(matchResult[1])}</del>;
};
export default {
name: "Strikethrough",
regexp: STRIKETHROUGH_REG,
renderer,
};