We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6ac7a33 commit 16f5c2eCopy full SHA for 16f5c2e
docs/.vitepress/theme/anchor/titleAnchorPreprocessor.ts
@@ -7,7 +7,8 @@ export const titleAnchorPreprocessor = (md: MarkdownIt) => {
7
const processedLines = lines.map((line) => {
8
if (line.startsWith("#")) {
9
const title = line.replace(new RegExp("#", "g"), "");
10
- const processedTitle = slugifyTitle(title);
+ const processedTitle = (line.includes("{") && line.includes("}")) ?
11
+ extractAnchor(title) : slugifyTitle(title);
12
return `
13
14
<TitleAnchor anchor="${processedTitle}">
@@ -24,3 +25,7 @@ ${line}
24
25
state.src = processedLines.join("\n");
26
});
27
}
28
+
29
+function extractAnchor(title: string): string {
30
+ return title.split("{")[1].split("}")[0];
31
+}
0 commit comments