feat: support code in headings (#2488)

Co-authored-by: zty <zty.dev@outlook.com>
This commit is contained in:
zty 2023-11-07 22:38:38 +08:00 committed by GitHub
parent 35f0861d6e
commit 184f79ef8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,6 @@
import { marked } from ".."; import { marked } from "..";
import { matcher } from "../matcher"; import { matcher } from "../matcher";
import InlineCode from "./InlineCode";
import Link from "./Link"; import Link from "./Link";
import PlainLink from "./PlainLink"; import PlainLink from "./PlainLink";
import PlainText from "./PlainText"; import PlainText from "./PlainText";
@ -13,7 +14,7 @@ const renderer = (rawStr: string) => {
} }
const level = matchResult[1].length; const level = matchResult[1].length;
const parsedContent = marked(matchResult[2], [], [Link, PlainLink, PlainText]); const parsedContent = marked(matchResult[2], [], [InlineCode, Link, PlainLink, PlainText]);
if (level === 1) { if (level === 1) {
return <h1>{parsedContent}</h1>; return <h1>{parsedContent}</h1>;
} else if (level === 2) { } else if (level === 2) {