Skip to content

Commit d3ac921

Browse files
committed
Replace "kt" in code blocks with "kotlin" for the language shown in the top right corner
1 parent 008f2ec commit d3ac921

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

docs/.vitepress/config.mts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,15 @@ const vitepressOptions: UserConfig = {
121121
exampleAutoAnchorPreprocessor(md);
122122
titleAnchorPreprocessor(md);
123123
mathjaxContainerPreprocessor(md);
124+
125+
// Replace "kt" in the top right of code blocks with "kotlin"
126+
const render = md.renderer.rules.fence!;
127+
md.renderer.rules.fence = (tokens, idx, options, env, self) => {
128+
if (tokens[idx].info.startsWith("kt[")) {
129+
tokens[idx].info = tokens[idx].info.replace("kt[", "kotlin[");
130+
}
131+
return render(tokens, idx, options, env, self);
132+
};
124133
}
125134
}
126135
}

0 commit comments

Comments
 (0)