mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-24 12:19:20 +00:00
@@ -10,7 +10,7 @@ import * as vscode from 'vscode';
|
|||||||
import { MarkdownContributionProvider as MarkdownContributionProvider } from './markdownExtensions';
|
import { MarkdownContributionProvider as MarkdownContributionProvider } from './markdownExtensions';
|
||||||
import { Slugifier } from './slugify';
|
import { Slugifier } from './slugify';
|
||||||
import { SkinnyTextDocument } from './tableOfContentsProvider';
|
import { SkinnyTextDocument } from './tableOfContentsProvider';
|
||||||
import { Schemes, isOfScheme } from './util/links';
|
import { MarkdownFileExtensions, Schemes, isOfScheme } from './util/links';
|
||||||
|
|
||||||
const UNICODE_NEWLINE_REGEX = /\u2028|\u2029/g;
|
const UNICODE_NEWLINE_REGEX = /\u2028|\u2029/g;
|
||||||
|
|
||||||
@@ -251,7 +251,9 @@ export class MarkdownEngine {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (uri.fragment) {
|
const extname = path.extname(uri.fsPath);
|
||||||
|
|
||||||
|
if (uri.fragment && (extname === '' || MarkdownFileExtensions.includes(extname))) {
|
||||||
uri = uri.with({
|
uri = uri.with({
|
||||||
fragment: this.slugifier.fromHeading(uri.fragment).value
|
fragment: this.slugifier.fromHeading(uri.fragment).value
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -32,3 +32,15 @@ export function getUriForLinkWithKnownExternalScheme(link: string): vscode.Uri |
|
|||||||
export function isOfScheme(scheme: string, link: string): boolean {
|
export function isOfScheme(scheme: string, link: string): boolean {
|
||||||
return link.toLowerCase().startsWith(scheme);
|
return link.toLowerCase().startsWith(scheme);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const MarkdownFileExtensions: readonly string[] = [
|
||||||
|
'.md',
|
||||||
|
'.mkd',
|
||||||
|
'.mdwn',
|
||||||
|
'.mdown',
|
||||||
|
'.markdown',
|
||||||
|
'.markdn',
|
||||||
|
'.mdtxt',
|
||||||
|
'.mdtext',
|
||||||
|
'.workbook',
|
||||||
|
];
|
||||||
|
|||||||
Reference in New Issue
Block a user