gitbook-plugin-edit-link
Advanced tools
Comparing version 1.0.0 to 1.1.0
39
index.js
module.exports = { | ||
book: { | ||
// assets: "./book", | ||
// js: [ | ||
// "test.js" | ||
// ], | ||
// css: [ | ||
// "test.css" | ||
// ], | ||
// html: { | ||
// "html:start": function() { | ||
// return "<!-- Start book "+this.options.title+" -->" | ||
// }, | ||
// "html:end": function() { | ||
// return "<!-- End of book "+this.options.title+" -->" | ||
// }, | ||
// | ||
// "head:start": "<!-- head:start -->", | ||
// "head:end": "<!-- head:end -->", | ||
// | ||
// "body:start": "<!-- body:start -->", | ||
// "body:end": "<!-- body:end -->" | ||
// } | ||
// }, | ||
hooks: { | ||
@@ -29,6 +6,16 @@ // After html generation | ||
page.content = page.content.replace( | ||
rtEditLinkBase = this.options.pluginsConfig.rtEditLinkBase; | ||
if (typeof this.options.pluginsConfig.rtEditLinkLabel === 'undefined') { | ||
rtEditLinkLabel = "Edit This Page"; | ||
} else { | ||
rtEditLinkLabel = this.options.pluginsConfig.rtEditLinkLabel; | ||
} | ||
rtEditLink = '<a href="' + this.options.pluginsConfig.rtEditLinkBase + '/' + page.path + '" class="btn fa fa-edit pull-left"> ' + rtEditLinkLabel + '</a>'; | ||
page.content = page.content.replace ( | ||
'<!-- Actions Right -->', | ||
'<a href="' + this.options.pluginsConfig.rtEditLinkBase + '/' + page.path + '" class="btn fa fa-edit pull-left"><b>Edit This Page on Github</b></a>' + '<!-- Actions Right -->' | ||
) | ||
rtEditLink + '<!-- Actions Right -->' | ||
) | ||
@@ -35,0 +22,0 @@ return page; |
@@ -5,3 +5,3 @@ { | ||
"main": "index.js", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"author": "rtCamp <admin@rtcamp.com>", | ||
@@ -8,0 +8,0 @@ "contributors": [{ |
@@ -15,2 +15,6 @@ GitBook Plugin: Edit Link | ||
### Changing Link Label (Localization) | ||
By default link label will be "Edit This Page". You can change it using plugin config `rtEditLinkLabel`. | ||
## Sample `book.json` file | ||
@@ -24,3 +28,4 @@ | ||
"pluginsConfig": { | ||
"rtEditLinkBase": "https://github.com/USER/REPO/edit/BRANCH/path/to/book" | ||
"rtEditLinkBase": "https://github.com/USER/REPO/edit/BRANCH/path/to/book", | ||
"rtEditLinkLabel": "Edit This Page" | ||
} | ||
@@ -27,0 +32,0 @@ } |
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
43
0
15317
5
19