Skip to content

Commit fb7653b

Browse files
author
James Phillpotts
committed
Fix URL creation on windows
1 parent 2e85380 commit fb7653b

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

lib/parse/renderer.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,11 @@ GitBookRenderer.prototype.link = function(href, title, text) {
4646
var o = this._extra_options;
4747
// Relative link, rewrite it to point to github repo
4848
if(!parsed.protocol && parsed.path && parsed.path[0] != '/' && o && o.repo && o.dir) {
49-
href = 'https://github.com/' + o.repo + '/blob' + path.normalize(path.join(
50-
'/',
51-
o.dir,
52-
href
53-
));
54-
parsed = url.parse(href);
49+
parsed = url.parse('https://github.com/' + o.repo + '/blob/').resolveObject([o.dir, href].join("/"));
5550
}
5651

5752
// Generate HTML for link
58-
var out = '<a href="' + href + '"';
53+
var out = '<a href="' + parsed.href + '"';
5954
// Title if no null
6055
if (title) {
6156
out += ' title="' + title + '"';

0 commit comments

Comments
 (0)