Skip to content
Permalink
Browse files

Fix href relative path

  • Loading branch information...
kenzauros committed Aug 27, 2019
1 parent f3fedef commit fb74708deb98653a30225e6190deb9482369ac4a
Showing with 3 additions and 3 deletions.
  1. +3 −3 extension.js
@@ -728,19 +728,19 @@ function fixHref(resource, href) {
}

// Use href as file URI if it is absolute
if (path.isAbsolute(href) || hrefUri.scheme === 'file') {
if (path.isAbsolute(href)) {
return vscode.Uri.file(href).toString();
}

// Use a workspace relative path if there is a workspace and markdown-pdf.stylesRelativePathFile is false
var stylesRelativePathFile = vscode.workspace.getConfiguration('markdown-pdf')['stylesRelativePathFile'];
let root = vscode.workspace.getWorkspaceFolder(resource);
if (stylesRelativePathFile === false && root) {
return vscode.Uri.file(path.join(root.uri.fsPath, href)).toString();
return path.join(root.uri.fsPath, href);
}

// Otherwise look relative to the markdown file
return vscode.Uri.file(path.join(path.dirname(resource.fsPath), href)).toString();
return path.join(path.dirname(resource.fsPath), href);
} catch (error) {
showErrorMessage('fixHref()', error);
}

0 comments on commit fb74708

Please sign in to comment.
You can’t perform that action at this time.