mirror of
https://github.com/usememos/memos.git
synced 2025-12-17 14:19:17 +08:00
feat: support code in headings (#2488)
Co-authored-by: zty <zty.dev@outlook.com>
This commit is contained in:
parent
35f0861d6e
commit
184f79ef8e
1 changed files with 2 additions and 1 deletions
|
|
@ -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) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue