| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 755f5e3 commit d165d3f
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -447,12 +447,12 @@ function buildToc(lexed, filename, cb) { | |||
| 447 | 447 | ||
| 448 | 448 | depth = tok.depth; | |
| 449 | 449 | const realFilename = path.basename(realFilenames[0], '.md'); | |
| 450 | - const id = getId(realFilename + '_' + tok.text.trim()); | ||
| 450 | + const id = getId(`${realFilename}_${tok.text.trim()}`); | ||
| 451 | 451 | toc.push(new Array((depth - 1) * 2 + 1).join(' ') + | |
| 452 | 452 | `* <span class="stability_${tok.stability}">` + | |
| 453 | 453 | `<a href="#${id}">${tok.text}</a></span>`); | |
| 454 | - tok.text += '<span><a class="mark" href="#' + id + '" ' + | ||
| 455 | - 'id="' + id + '">#</a></span>'; | ||
| 454 | + tok.text += `<span><a class="mark" href="#${id}"` + | ||
| 455 | + `id="${id}">#</a></span>`; | ||
| 456 | 456 | }); | |
| 457 | 457 | ||
| 458 | 458 | toc = marked.parse(toc.join('\n')); | |
@@ -466,7 +466,7 @@ function getId(text) { | |||
| 466 | 466 | text = text.replace(/^_+|_+$/, ''); | |
| 467 | 467 | text = text.replace(/^([^a-z])/, '_$1'); | |
| 468 | 468 | if (idCounters.hasOwnProperty(text)) { | |
| 469 | - text += '_' + (++idCounters[text]); | ||
| 469 | + text += `_${(++idCounters[text])}`; | ||
| 470 | 470 | } else { | |
| 471 | 471 | idCounters[text] = 0; | |
| 472 | 472 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments