File tree Expand file tree Collapse file tree
extensions/markdown-language-features/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ import * as vscode from 'vscode';
1010import { MarkdownContributionProvider as MarkdownContributionProvider } from './markdownExtensions' ;
1111import { Slugifier } from './slugify' ;
1212import { SkinnyTextDocument } from './tableOfContentsProvider' ;
13- import { Schemes , isOfScheme } from './util/links' ;
13+ import { MarkdownFileExtensions , Schemes , isOfScheme } from './util/links' ;
1414
1515const UNICODE_NEWLINE_REGEX = / \u2028 | \u2029 / g;
1616
@@ -251,7 +251,9 @@ export class MarkdownEngine {
251251 }
252252 }
253253
254- if ( uri . fragment ) {
254+ const extname = path . extname ( uri . fsPath ) ;
255+
256+ if ( uri . fragment && ( extname === '' || MarkdownFileExtensions . includes ( extname ) ) ) {
255257 uri = uri . with ( {
256258 fragment : this . slugifier . fromHeading ( uri . fragment ) . value
257259 } ) ;
Original file line number Diff line number Diff line change @@ -32,3 +32,15 @@ export function getUriForLinkWithKnownExternalScheme(link: string): vscode.Uri |
3232export function isOfScheme ( scheme : string , link : string ) : boolean {
3333 return link . toLowerCase ( ) . startsWith ( scheme ) ;
3434}
35+
36+ export const MarkdownFileExtensions : readonly string [ ] = [
37+ '.md' ,
38+ '.mkd' ,
39+ '.mdwn' ,
40+ '.mdown' ,
41+ '.markdown' ,
42+ '.markdn' ,
43+ '.mdtxt' ,
44+ '.mdtext' ,
45+ '.workbook' ,
46+ ] ;
You can’t perform that action at this time.
0 commit comments