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.
22 lines
464 B
TypeScript
22 lines
464 B
TypeScript
import { marked } from "..";
|
|
import Emphasis from "./Emphasis";
|
|
import Link from "./Link";
|
|
|
|
export const BOLD_REG = /\*\*([\S *]+)\*\*/;
|
|
|
|
const renderer = (rawStr: string): string => {
|
|
const matchResult = rawStr.match(BOLD_REG);
|
|
if (!matchResult) {
|
|
return rawStr;
|
|
}
|
|
|
|
const parsedContent = marked(matchResult[1], [], [Emphasis, Link]);
|
|
return `<strong>${parsedContent}</strong>`;
|
|
};
|
|
|
|
export default {
|
|
name: "bold",
|
|
regex: BOLD_REG,
|
|
renderer,
|
|
};
|