8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation. 8000
There was an error while loading. Please reload this page.
master
HEAD
1 parent 2ebfc25 commit 3ce7ac6Copy full SHA for 3ce7ac6
generate/plugin/rehype-rewrite-urls.js
@@ -113,6 +113,11 @@ function urls(options) {
113
if (host === 'github.com') {
114
rest = url.pathname.slice(1).split('/')
115
116
+ // Tree goes to directories, blob to files.
117
+ if (rest[3] === 'master' && (rest[2] === 'tree' || rest[2] === 'blob')) {
118
+ rest[3] = 'HEAD'
119
+ }
120
+
121
repo = rest.slice(0, 2).join('/')
122
123
if (own.call(data.projectByRepo, repo)) {
@@ -160,6 +165,8 @@ function urls(options) {
160
165
if (!url.hash && rest.length === 0) {
161
166
return new URL('/explore/project/' + repo + '/', origin)
162
167
}
168
+ } else {
169
+ return new URL('/' + rest.join('/'), 'https://github.com')
163
170
164
171
172
0 commit comments