Skip to content

Commit 5d57f51

Browse files
committed
fix core module readme links
close #2 thanks @dignifiedquire :)
1 parent a918220 commit 5d57f51

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

scripts/read.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,12 @@ function formatReadme (module) {
126126
// Resolve relative URLs in READMEs for images and anchors
127127
$('a:not([href^=http]):not([href^=#])').each(function(i,el) {
128128
var $a = $(el)
129-
$a.attr('href', 'http://github.com/' + module.path + '/blob/master/' + (module.subpath || '') + $a.attr('href'))
129+
$a.attr('href', 'http://github.com/' + module.path + '/blob/master/' + (module.subpath ? `docs/${module.subpath}/../` : '') + $a.attr('href'))
130130
})
131131

132132
$('img:not([src^=http])').each(function(i,el) {
133133
var $img = $(el)
134-
$img.attr('src', 'https://raw.githubusercontent.com/' + module.path + '/master/' (module.subpath || '') + $img.attr('src'))
134+
$img.attr('src', 'https://raw.githubusercontent.com/' + module.path + '/master/' (module.subpath ? `docs/${module.subpath}/../` : '') + $img.attr('src'))
135135
})
136136

137137
// guarantee that the first heading is an <h1>,
@@ -140,7 +140,7 @@ function formatReadme (module) {
140140
if (headings && headings[0] && module.path) {
141141
$(headings[0]).replaceWith($(
142142
'<h1 class="title">'
143-
+ '<a target="_blank" href="https://github.com/'+module.path+ (module.subpath ? `/blob/master/${module.subpath}.md` : '')+'">'
143+
+ '<a target="_blank" href="https://github.com/'+module.path+ (module.subpath ? `/blob/master/docs/${module.subpath}.md` : '')+'">'
144144
+ $(headings[0]).text()
145145
+ '</a>'
146146
+ '<div class="contrib"></div>'

0 commit comments

Comments
 (0)