Skip to content

Commit 0f7cb91

Browse files
budmc29montogeek
authored andcommitted
fix(ux): Convert github raw links to rendered page links (#2555)
As discussed in #2470
1 parent 8b7ba92 commit 0f7cb91

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/utilities/process-readme.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,12 @@ module.exports = function processREADME(body, options = {}) {
2424

2525
// Only resolve non-absolute urls from their source if they are not a document fragment link
2626
if (!href.startsWith('#')) {
27-
href = url.resolve(options.source, href);
27+
// Convert Github raw links to rendered links
28+
let rendered_url = options.source
29+
.replace(/raw.githubusercontent.com/, 'github.com')
30+
.replace(/master/, 'blob/master');
31+
32+
href = url.resolve(rendered_url, href);
2833
}
2934

3035
// Modify absolute documenation links to be root relative

0 commit comments

Comments
 (0)