mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 16:29:51 +03:00
added wiki docs
This commit is contained in:
28
docs/_assets/edit-link.js
Normal file
28
docs/_assets/edit-link.js
Normal file
@@ -0,0 +1,28 @@
|
||||
function normalizeGithubUrl(url) {
|
||||
if (!url) { return null }
|
||||
|
||||
var isAlias = !/\/\//.test(url) // no protocol in the url, we assume it's an alias
|
||||
url = isAlias
|
||||
? 'https://github.com/' + url + '/edit/master/docs/'
|
||||
: url.replace(/^git\+/, '')
|
||||
|
||||
return url
|
||||
}
|
||||
|
||||
function install(hook, vm) {
|
||||
var editLinkConfig = vm.config.editLink || {}
|
||||
var text = editLinkConfig.text || 'Edit this page'
|
||||
var cssClass = editLinkConfig.cssClass || 'edit-link'
|
||||
var repoUrl = normalizeGithubUrl(editLinkConfig.repo || vm.config.repo)
|
||||
|
||||
if (!repoUrl) { throw Error('$docsify.editLink.repo is required. Fix your config.') }
|
||||
|
||||
hook.afterEach(function (html) {
|
||||
var editLink = '<span style="text-align: right; color:#1FA3EC; font-size:80%">' +
|
||||
'<a href="' + repoUrl + vm.route.file + '" target="_blank" style="text-decoration: none;">' + text + '</a></span>'
|
||||
|
||||
return editLink + html
|
||||
});
|
||||
}
|
||||
|
||||
$docsify.plugins = [].concat(install, $docsify.plugins)
|
||||
Reference in New Issue
Block a user