File tree Expand file tree Collapse file tree 2 files changed +54
-3
lines changed
Expand file tree Collapse file tree 2 files changed +54
-3
lines changed Original file line number Diff line number Diff line change 2424 < body >
2525 < div id ="app "> </ div >
2626 <!-- edit on github plugin must appear here -->
27- < script src ="//unpkg.com/ docsify-edit-on-github@1.0.1/index .js "> </ script >
27+ < script src ="scripts/ docsify-edit-on-github.js "> </ script >
2828 < script >
2929 window . $docsify = {
3030 name : "asdf-vm" ,
6262 } ,
6363 plugins : [
6464 EditOnGithubPlugin . create (
65- "https://github.com/asdf-vm/asdf/blob/master/docs/"
66- ) ,
65+ "https://github.com/asdf-vm/asdf/blob/master/docs/" , {
66+ customURLs : {
67+ "https://raw.githubusercontent.com/asdf-vm/asdf-plugins/master/README.md" : "https://github.com/asdf-vm/asdf-plugins/edit/master/README.md" ,
68+ "https://raw.githubusercontent.com/asdf-vm/asdf/master/CHANGELOG.md" : "https://github.com/asdf-vm/asdf/edit/master/CHANGELOG.md"
69+ }
70+ } )
6771 ] ,
6872 } ;
6973 </ script >
Original file line number Diff line number Diff line change 1+ ; ( function ( win ) {
2+ win . EditOnGithubPlugin = { }
3+
4+ function create ( docBase , options ) {
5+ options = options || { }
6+ title = options . title || 'Edit on github'
7+ customURLs = options . customURLs || { }
8+ var docEditBase = docBase . replace ( / \/ b l o b \/ / , '/edit/' )
9+
10+ function editDoc ( event , vm ) {
11+ var docName = vm . route . file
12+
13+ if ( docName ) {
14+ var editLink = customURLs [ docName ] || docEditBase + docName
15+ window . open ( editLink )
16+ event . preventDefault ( )
17+ return false
18+ } else {
19+ return true
20+ }
21+ }
22+
23+ win . EditOnGithubPlugin . editDoc = editDoc
24+
25+ return function ( hook , vm ) {
26+ win . EditOnGithubPlugin . onClick = function ( event ) {
27+ EditOnGithubPlugin . editDoc ( event , vm )
28+ }
29+
30+ var header = [
31+ '<div style="overflow: auto">' ,
32+ '<p style="float: right"><a href="' ,
33+ docBase ,
34+ '" target="_blank" onclick="EditOnGithubPlugin.onClick(event)">' ,
35+ title ,
36+ '</a></p>' ,
37+ '</div>'
38+ ] . join ( '' )
39+
40+ hook . afterEach ( function ( html ) {
41+ return header + html
42+ } )
43+ }
44+ }
45+
46+ win . EditOnGithubPlugin . create = create
47+ } ) ( window )
You can’t perform that action at this time.
0 commit comments