chore: fix edit docs button, fixed #562
This commit is contained in:
parent
845b1f2990
commit
78b3a6d007
2 changed files with 15 additions and 2 deletions
|
|
@ -62,7 +62,13 @@
|
||||||
plugins: [
|
plugins: [
|
||||||
function (hook, vm) {
|
function (hook, vm) {
|
||||||
hook.beforeEach(function (html) {
|
hook.beforeEach(function (html) {
|
||||||
var url = 'https://github.com/docsifyjs/docsify/blob/master/docs/' + vm.route.file
|
if (/githubusercontent\.com/.test(vm.route.file)) {
|
||||||
|
url = vm.route.file
|
||||||
|
.replace('raw.githubusercontent.com', 'github.com')
|
||||||
|
.replace(/\/master/, '/blob/master')
|
||||||
|
} else {
|
||||||
|
url = 'https://github.com/docsifyjs/docsify/blob/master/' + vm.route.file
|
||||||
|
}
|
||||||
var editHtml = '[:memo: Edit Document](' + url + ')\n'
|
var editHtml = '[:memo: Edit Document](' + url + ')\n'
|
||||||
|
|
||||||
return editHtml
|
return editHtml
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,14 @@
|
||||||
plugins: [
|
plugins: [
|
||||||
function (hook, vm) {
|
function (hook, vm) {
|
||||||
hook.beforeEach(function (html) {
|
hook.beforeEach(function (html) {
|
||||||
var url = 'https://github.com/docsifyjs/docsify/blob/master/' + vm.route.file
|
var url
|
||||||
|
if (/githubusercontent\.com/.test(vm.route.file)) {
|
||||||
|
url = vm.route.file
|
||||||
|
.replace('raw.githubusercontent.com', 'github.com')
|
||||||
|
.replace(/\/master/, '/blob/master')
|
||||||
|
} else {
|
||||||
|
url = 'https://github.com/docsifyjs/docsify/blob/master/' + vm.route.file
|
||||||
|
}
|
||||||
var editHtml = '[:memo: Edit Document](' + url + ')\n'
|
var editHtml = '[:memo: Edit Document](' + url + ')\n'
|
||||||
|
|
||||||
return editHtml
|
return editHtml
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue