Skip to content

Commit 90c2e09

Browse files
authored
Merge pull request #73 from vimtaai/release/1.0.0
Allow online CSS in #67
2 parents 9dcc3a2 + 7170edd commit 90c2e09

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

extension.js

+13-6
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ function readStyles() {
563563
var href = filename = styles[i];
564564
var protocol = url.parse(href).protocol;
565565
if (protocol === 'http:' || protocol === 'https:') {
566-
style += '<link rel=\"stylesheet\" href=\"" + href + "\" type=\"text/css\">';
566+
style += '<link rel=\"stylesheet\" href=\"' + href + '\" type=\"text/css\">';
567567
} else if (protocol === 'file:') {
568568
style += makeCss(filename);
569569
}
@@ -595,15 +595,22 @@ function readStyles() {
595595
styles = vscode.workspace.getConfiguration('markdown-pdf')['styles'] || '';
596596
if (styles && Array.isArray(styles) && styles.length > 0) {
597597
for (i = 0; i < styles.length; i++) {
598-
filename = styles[i];
598+
var href = filename = styles[i];
599+
var protocol = url.parse(href).protocol;
599600
if (!path.isAbsolute(filename)) {
600-
if (vscode.workspace.rootPath == undefined) {
601-
filename = path.join(path.dirname(mdfilename), filename);
601+
if (protocol === 'http:' || protocol === 'https:') {
602+
style += '<link rel=\"stylesheet\" href=\"' + href + '\" type=\"text/css\">';
602603
} else {
603-
filename = path.join(vscode.workspace.rootPath, filename);
604+
if (vscode.workspace.rootPath == undefined) {
605+
filename = path.join(path.dirname(mdfilename), filename);
606+
} else {
607+
filename = path.join(vscode.workspace.rootPath, filename);
608+
}
609+
style += makeCss(filename);
604610
}
611+
} else {
612+
style += makeCss(filename);
605613
}
606-
style += makeCss(filename);
607614
}
608615
}
609616

package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)