提交 36ce3d15 编写于 作者: M Matt Bierner

Show header level in markdown Fixes #25574

上级 4b9a244c
......@@ -19,7 +19,7 @@ export default class MDDocumentSymbolProvider implements vscode.DocumentSymbolPr
provideDocumentSymbols(document: vscode.TextDocument): vscode.ProviderResult<vscode.SymbolInformation[]> {
const toc = new TableOfContentsProvider(this.engine, document);
return toc.getToc().map(entry => {
return new vscode.SymbolInformation(entry.text, vscode.SymbolKind.Module, '', entry.location);
return new vscode.SymbolInformation(entry.text, vscode.SymbolKind.Namespace, '', entry.location);
});
}
}
\ No newline at end of file
......@@ -66,7 +66,7 @@ export class TableOfContentsProvider {
}
private static getHeaderText(header: string): string {
return header.replace(/^\s*(#)+\s*(.*?)\s*\1*$/, '$2').trim();
return header.replace(/^\s*(#+)\s*(.*?)\s*\1*$/, (_, level, word) => `${level} ${word.trim()}`);
}
public static slugify(header: string): string {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册