mirror of
https://github.com/chaitin/SafeLine.git
synced 2026-02-02 23:03:56 +08:00
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user