Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8538354

Browse filesBrowse files
joyeecheungMylesBorins
authored andcommitted
tools: add direct anchors for error codes
This adds direct anchors for the error codes in errors.html. For example, previously the anchor for ERR_ASSERTION is #errors_err_assertion, now there is also #ERR_ASSERTION. PR-URL: #16779 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 1b1bd26 commit 8538354
Copy full SHA for 8538354

File tree

Expand file treeCollapse file tree

1 file changed

+9
-3
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+9
-3
lines changed
Open diff view settings
Collapse file

‎tools/doc/html.js‎

Copy file name to clipboardExpand all lines: tools/doc/html.js
+9-3Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,9 @@ function getSection(lexed) {
472472
return '';
473473
}
474474

475+
function getMark(anchor) {
476+
return `<span><a class="mark" href="#${anchor}" id="${anchor}">#</a></span>`;
477+
}
475478

476479
function buildToc(lexed, filename, cb) {
477480
var toc = [];
@@ -499,12 +502,15 @@ function buildToc(lexed, filename, cb) {
499502

500503
depth = tok.depth;
501504
const realFilename = path.basename(realFilenames[0], '.md');
502-
const id = getId(`${realFilename}_${tok.text.trim()}`);
505+
const apiName = tok.text.trim();
506+
const id = getId(`${realFilename}_${apiName}`);
503507
toc.push(new Array((depth - 1) * 2 + 1).join(' ') +
504508
`* <span class="stability_${tok.stability}">` +
505509
`<a href="#${id}">${tok.text}</a></span>`);
506-
tok.text += `<span><a class="mark" href="#${id}"` +
507-
`id="${id}">#</a></span>`;
510+
tok.text += getMark(id);
511+
if (realFilename === 'errors' && apiName.startsWith('ERR_')) {
512+
tok.text += getMark(apiName);
513+
}
508514
});
509515

510516
toc = marked.parse(toc.join('\n'));

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.