镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions tools/doc/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const DOC_CREATED_REG_EXP = /<!--\s*introduced_in\s*=\s*v([0-9]+)\.([0-9]+)\.([0
// customized heading without id attribute
const renderer = new marked.Renderer();
renderer.heading = function(text, level) {
return '<h' + level + '>' + text + '</h' + level + '>\n';
return `<h${level}>${text}</h${level}>\n`;
};
marked.setOptions({
renderer: renderer
Expand Down Expand Up @@ -107,7 +107,7 @@ function loadGtoc(cb) {
if (err) return cb(err);

data = marked(data).replace(/<a href="(.*?)"/gm, function(a, m) {
return '<a class="nav-' + toID(m) + '" href="' + m + '"';
return `<a class="nav-${toID(m)}" href="${m}"`;
});
return cb(null, data);
});
Expand Down Expand Up @@ -152,7 +152,7 @@ function render(opts, cb) {
template = template.replace(/__TOC__/g, toc);
template = template.replace(
/__GTOC__/g,
gtocData.replace('class="nav-' + id, 'class="nav-' + id + ' active')
gtocData.replace(`class="nav-${id}`, `class="nav-${id} active`)
);

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