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 — tools: use template literals · sclarson/node@28a5fd0

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • tools/doc
    • html.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎tools/doc/html.js‎

Copy file name to clipboardExpand all lines: tools/doc/html.js
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const DOC_CREATED_REG_EXP = /<!--\s*introduced_in\s*=\s*v([0-9]+)\.([0-9]+)\.([0
3636
// customized heading without id attribute
3737
const renderer = new marked.Renderer();
3838
renderer.heading = function(text, level) {
39-
return '<h' + level + '>' + text + '</h' + level + '>\n';
39+
return `<h${level}>${text}</h${level}>\n`;
4040
};
4141
marked.setOptions({
4242
renderer: renderer
@@ -107,7 +107,7 @@ function loadGtoc(cb) {
107107
if (err) return cb(err);
108108

109109
data = marked(data).replace(/<a href="(.*?)"/gm, function(a, m) {
110-
return '<a class="nav-' + toID(m) + '" href="' + m + '"';
110+
return `<a class="nav-${toID(m)}" href="${m}"`;
111111
});
112112
return cb(null, data);
113113
});
@@ -152,7 +152,7 @@ function render(opts, cb) {
152152
template = template.replace(/__TOC__/g, toc);
153153
template = template.replace(
154154
/__GTOC__/g,
155-
gtocData.replace('class="nav-' + id, 'class="nav-' + id + ' active')
155+
gtocData.replace(`class="nav-${id}`, `class="nav-${id} active`)
156156
);
157157

158158
if (opts.analytics) {
@@ -500,8 +500,8 @@ function buildToc(lexed, filename, cb) {
500500
const realFilename = path.basename(realFilenames[0], '.md');
501501
const id = getId(realFilename + '_' + tok.text.trim());
502502
toc.push(new Array((depth - 1) * 2 + 1).join(' ') +
503-
'* <span class="stability_' + tok.stability + '">' +
504-
'<a href="#' + id + '">' + tok.text + '</a></span>');
503+
`* <span class="stability_${tok.stability}">` +
504+
`<a href="#${id}">${tok.text}</a></span>`);
505505
tok.text += '<span><a class="mark" href="#' + id + '" ' +
506506
'id="' + id + '">#</a></span>';
507507
});

0 commit comments

Comments
0 (0)
You are visitor 01402792 — 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.