GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — doc: add "Edit on GitHub" link · nodejs/node@0de0f89

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • doc
    • api_assets
      • style.css
    • template.html
  • tools/doc
    • allhtml.js
    • html.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎doc/api_assets/style.css‎

Copy file name to clipboardExpand all lines: doc/api_assets/style.css
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,11 @@ th > *:last-child, td > *:last-child {
504504
visibility: hidden;
505505
}
506506

507+
.github_icon {
508+
vertical-align: middle;
509+
margin: -2px 3px 0 0;
510+
}
511+
507512
@media only screen and (max-width: 1024px) {
508513
#content {
509514
overflow: visible;
Collapse file

‎doc/template.html‎

Copy file name to clipboardExpand all lines: doc/template.html
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ <h1>Node.js __VERSION__ Documentation</h1>
3535
<a href="__FILENAME__.json">View as JSON</a>
3636
</li>
3737
__ALTDOCS__
38+
__EDIT_ON_GITHUB__
3839
</ul>
3940
</div>
4041
<hr>
Collapse file

‎tools/doc/allhtml.js‎

Copy file name to clipboardExpand all lines: tools/doc/allhtml.js
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ let all = toc.replace(/index\.html/g, 'all.html')
5252
.replace('<a href="all.html" name="toc">', '<a href="index.html" name="toc">')
5353
.replace('index.json', 'all.json')
5454
.replace('api-section-index', 'api-section-all')
55-
.replace('data-id="index"', 'data-id="all"');
55+
.replace('data-id="index"', 'data-id="all"')
56+
.replace(/<li class="edit_on_github">.*?<\/li>/, '');
5657

5758
// Clean up the title.
5859
all = all.replace(/<title>.*?\| /, '<title>');
Collapse file

‎tools/doc/html.js‎

Copy file name to clipboardExpand all lines: tools/doc/html.js
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ function toHTML({ input, filename, nodeVersion, analytics }, cb) {
9696
HTML = HTML.replace('__ALTDOCS__', '');
9797
}
9898

99+
HTML = HTML.replace('__EDIT_ON_GITHUB__', editOnGitHub(filename));
100+
99101
// Content insertion has to be the last thing we do with the lexed tokens,
100102
// because it's destructive.
101103
HTML = HTML.replace('__CONTENT__', marked.parser(lexed));
@@ -377,3 +379,9 @@ function altDocs(filename, docCreated) {
377379
</li>
378380
` : '';
379381
}
382+
383+
// eslint-disable-next-line max-len
384+
const githubLogo = '<span class="github_icon"><svg height="16" width="16" viewBox="0 0 16.1 16.1" fill="currentColor"><path d="M8 0a8 8 0 0 0-2.5 15.6c.4 0 .5-.2.5-.4v-1.5c-2 .4-2.5-.5-2.7-1 0-.1-.5-.9-.8-1-.3-.2-.7-.6 0-.6.6 0 1 .6 1.2.8.7 1.2 1.9 1 2.4.7 0-.5.2-.9.5-1-1.8-.3-3.7-1-3.7-4 0-.9.3-1.6.8-2.2 0-.2-.3-1 .1-2 0 0 .7-.3 2.2.7a7.4 7.4 0 0 1 4 0c1.5-1 2.2-.8 2.2-.8.5 1.1.2 2 .1 2.1.5.6.8 1.3.8 2.2 0 3-1.9 3.7-3.6 4 .3.2.5.7.5 1.4v2.2c0 .2.1.5.5.4A8 8 0 0 0 16 8a8 8 0 0 0-8-8z"/></svg></span>';
385+
function editOnGitHub(filename) {
386+
return `<li class="edit_on_github"><a href="https://github.com/nodejs/node/edit/master/doc/api/${filename}.md">${githubLogo}Edit on GitHub</a></li>`;
387+
}

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.