mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-27 12:04:04 +01:00
Fixes #60374 Some markdown-it extensions end up reprocessing the same tokens multiple times. This can result in our link normalized being re-invoked on a link, which causes it to fail Fix to to make sure that `vscode-resource` is a recongized link so that we don't try re-normalizing in these cases
18 lines
710 B
TypeScript
18 lines
710 B
TypeScript
/*---------------------------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
|
|
import * as vscode from 'vscode';
|
|
|
|
const knownSchemes = ['http:', 'https:', 'file:', 'mailto:', 'vscode-resource:'];
|
|
|
|
export function getUriForLinkWithKnownExternalScheme(
|
|
link: string,
|
|
): vscode.Uri | undefined {
|
|
if (knownSchemes.some(knownScheme => link.toLowerCase().startsWith(knownScheme))) {
|
|
return vscode.Uri.parse(link);
|
|
}
|
|
|
|
return undefined;
|
|
} |