diff --git a/doc/api_assets/style.css b/doc/api_assets/style.css
index b4da3375d5b521..f59f3770048097 100644
--- a/doc/api_assets/style.css
+++ b/doc/api_assets/style.css
@@ -504,6 +504,11 @@ th > *:last-child, td > *:last-child {
visibility: hidden;
}
+.github_icon {
+ vertical-align: middle;
+ margin: -2px 3px 0 0;
+}
+
@media only screen and (max-width: 1024px) {
#content {
overflow: visible;
diff --git a/doc/template.html b/doc/template.html
index bb3e2bf8b4f2f0..fdcf0d5821b56f 100644
--- a/doc/template.html
+++ b/doc/template.html
@@ -35,6 +35,7 @@
Node.js __VERSION__ Documentation
View as JSON
__ALTDOCS__
+ __EDIT_ON_GITHUB__
diff --git a/tools/doc/allhtml.js b/tools/doc/allhtml.js
index 1c84e13d0ab79c..d185538ab683b6 100644
--- a/tools/doc/allhtml.js
+++ b/tools/doc/allhtml.js
@@ -52,7 +52,8 @@ let all = toc.replace(/index\.html/g, 'all.html')
.replace('', '')
.replace('index.json', 'all.json')
.replace('api-section-index', 'api-section-all')
- .replace('data-id="index"', 'data-id="all"');
+ .replace('data-id="index"', 'data-id="all"')
+ .replace(/.*?<\/li>/, '');
// Clean up the title.
all = all.replace(/.*?\| /, '');
diff --git a/tools/doc/html.js b/tools/doc/html.js
index 0e254f1203f7a6..0f3293dadd51d1 100644
--- a/tools/doc/html.js
+++ b/tools/doc/html.js
@@ -96,6 +96,8 @@ function toHTML({ input, filename, nodeVersion, analytics }, cb) {
HTML = HTML.replace('__ALTDOCS__', '');
}
+ HTML = HTML.replace('__EDIT_ON_GITHUB__', editOnGitHub(filename));
+
// Content insertion has to be the last thing we do with the lexed tokens,
// because it's destructive.
HTML = HTML.replace('__CONTENT__', marked.parser(lexed));
@@ -377,3 +379,9 @@ function altDocs(filename, docCreated) {
` : '';
}
+
+// eslint-disable-next-line max-len
+const githubLogo = '';
+function editOnGitHub(filename) {
+ return `${githubLogo}Edit on GitHub`;
+}