extensions/markdown-language-features/src/util/openDocumentLink.ts/resolveDocumentLink
export function resolveDocumentLink(href: string, markdownFile: vscode.Uri): vscode.Uri {
	let [hrefPath, fragment] = href.split('#').map(c => decodeURIComponent(c));

	if (hrefPath[0] === '/') {
		// Absolute path. Try to resolve relative to the workspace
		const workspace = vscode.workspace.getWorkspaceFolder(markdownFile);
		if (workspace) {
			return vscode.Uri.joinPath(workspace.uri, hrefPath.slice(1)).with({ fragment });
		}
	}

	// Relative path. Resolve relative to the md file
	const dirnameUri = markdownFile.with({ path: path.dirname(markdownFile.path) });
	return vscode.Uri.joinPath(dirnameUri, hrefPath).with({ fragment });
}