Skip to content

Commit

Permalink
Merge pull request yzane#73 from vimtaai/release/1.0.0
Browse files Browse the repository at this point in the history
Allow online CSS in yzane#67
  • Loading branch information
yzane authored Apr 21, 2018
2 parents abbf5d5 + f328581 commit 5dd5b37
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
19 changes: 13 additions & 6 deletions extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ function readStyles() {
var href = filename = styles[i];
var protocol = url.parse(href).protocol;
if (protocol === 'http:' || protocol === 'https:') {
style += '<link rel=\"stylesheet\" href=\"" + href + "\" type=\"text/css\">';
style += '<link rel=\"stylesheet\" href=\"' + href + '\" type=\"text/css\">';
} else if (protocol === 'file:') {
style += makeCss(filename);
}
Expand Down Expand Up @@ -595,15 +595,22 @@ function readStyles() {
styles = vscode.workspace.getConfiguration('markdown-pdf')['styles'] || '';
if (styles && Array.isArray(styles) && styles.length > 0) {
for (i = 0; i < styles.length; i++) {
filename = styles[i];
var href = filename = styles[i];
var protocol = url.parse(href).protocol;
if (!path.isAbsolute(filename)) {
if (vscode.workspace.rootPath == undefined) {
filename = path.join(path.dirname(mdfilename), filename);
if (protocol === 'http:' || protocol === 'https:') {
style += '<link rel=\"stylesheet\" href=\"' + href + '\" type=\"text/css\">';
} else {
filename = path.join(vscode.workspace.rootPath, filename);
if (vscode.workspace.rootPath == undefined) {
filename = path.join(path.dirname(mdfilename), filename);
} else {
filename = path.join(vscode.workspace.rootPath, filename);
}
style += makeCss(filename);
}
} else {
style += makeCss(filename);
}
style += makeCss(filename);
}
}

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5dd5b37

Please sign in to comment.