Merge pull request #91 from guanweiwang/main

fix: markdown nav title
This commit is contained in:
zclaiqcc
2023-06-05 10:45:51 +08:00
committed by GitHub

View File

@@ -86,10 +86,10 @@ const MarkdownNavbar: FC<MarkdownNavbarProps> = (props) => {
const getNavStructure: (source: string) => Nav[] = (source) => {
const contentWithoutCode = source
.replace(/```[^`\n]*\n+[^```]+```\n+/g, "")
.replace(/^[^#]+\n/g, "")
.replace(/(?:[^\n#]+)#+\s([^#\n]+)\n*/g, "") // 匹配行内出现 # 号的情况
.replace(/^#\s[^#\n]*\n+/, "")
.replace(/```[^`\n]*\n+[^```]+```\n+/g, "")
.replace(/`([^`\n]+)`/g, "$1")
.replace(/\*\*?([^*\n]+)\*\*?/g, "$1")
.replace(/__?([^_\n]+)__?/g, "$1")