Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function clickTagA(uri, href) {
href = decodeURIComponent(href);
href = href.replace(/^vscode\-resource:\/\/\//, "file:///");
if (
[".pdf", ".xls", ".xlsx", ".doc", ".ppt", ".docx", ".pptx"].indexOf(
path.extname(href),
) >= 0
) {
utility.openFile(href);
} else if (href.match(/^file\:\/\/\//)) {
// openFilePath = href.slice(8) # remove protocol
let openFilePath = utility.addFileProtocol(
href.replace(/(\s*)[\#\?](.+)$/, ""),
); // remove #anchor and ?params...
openFilePath = decodeURI(openFilePath);
vscode.commands.executeCommand(
"vscode.open",
vscode.Uri.parse(openFilePath),
vscode.ViewColumn.One,
);
} else {
utility.openFile(href);
}
}
function openMathJaxConfig() {
const mathjaxConfigFilePath = utility.addFileProtocol(
path.resolve(utility.extensionConfigDirectoryPath, "./mathjax_config.js"),
);
vscode.commands.executeCommand(
"vscode.open",
vscode.Uri.parse(mathjaxConfigFilePath),
);
}
function openKaTeXConfig() {
const katexConfigFilePath = utility.addFileProtocol(
path.resolve(utility.extensionConfigDirectoryPath, "./katex_config.js"),
);
vscode.commands.executeCommand(
"vscode.open",
vscode.Uri.parse(katexConfigFilePath),
);
}
function extendParser() {
const parserConfigPath = utility.addFileProtocol(
path.resolve(utility.extensionConfigDirectoryPath, "./parser.js"),
);
vscode.commands.executeCommand(
"vscode.open",
vscode.Uri.parse(parserConfigPath),
);
}
function openMermaidConfig() {
const mermaidConfigFilePath = utility.addFileProtocol(
path.resolve(utility.extensionConfigDirectoryPath, "./mermaid_config.js"),
);
vscode.commands.executeCommand(
"vscode.open",
vscode.Uri.parse(mermaidConfigFilePath),
);
}
function customizeCSS() {
const globalStyleLessFile = utility.addFileProtocol(
path.resolve(utility.extensionConfigDirectoryPath, "./style.less"),
);
vscode.commands.executeCommand(
"vscode.open",
vscode.Uri.parse(globalStyleLessFile),
);
}
function showUploadedImages() {
const imageHistoryFilePath = utility.addFileProtocol(
path.resolve(utility.extensionConfigDirectoryPath, "./image_history.md"),
);
vscode.commands.executeCommand(
"vscode.open",
vscode.Uri.parse(imageHistoryFilePath),
);
}