Skip to content

Commit

Permalink
Show header level in markdown Fixes #25574
Browse files Browse the repository at this point in the history
  • Loading branch information
mjbvz committed May 2, 2017
1 parent 4b9a244 commit 36ce3d1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion extensions/markdown/src/documentSymbolProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
}
}
2 changes: 1 addition & 1 deletion extensions/markdown/src/tableOfContentsProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 36ce3d1

Please sign in to comment.