Path: blob/main/extensions/markdown-language-features/src/util/dom.ts
3292 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/4import * as vscode from 'vscode';56export function escapeAttribute(value: string | vscode.Uri): string {7return value.toString()8.replace(/&/g, '&')9.replace(/"/g, '"')10.replace(/'/g, ''');11}1213export function getNonce() {14let text = '';15const possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';16for (let i = 0; i < 64; i++) {17text += possible.charAt(Math.floor(Math.random() * possible.length));18}19return text;20}212223