mirror of https://github.com/usememos/memos
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.
20 lines
410 B
TypeScript
20 lines
410 B
TypeScript
import { marked } from "..";
|
|
|
|
export const STRIKETHROUGH_REG = /~~(.+?)~~/;
|
|
|
|
const renderer = (rawStr: string): string => {
|
|
const matchResult = rawStr.match(STRIKETHROUGH_REG);
|
|
if (!matchResult) {
|
|
return rawStr;
|
|
}
|
|
|
|
const parsedContent = marked(matchResult[1], [], []);
|
|
return `<del>${parsedContent}</del>`;
|
|
};
|
|
|
|
export default {
|
|
name: "Strikethrough",
|
|
regex: STRIKETHROUGH_REG,
|
|
renderer,
|
|
};
|