MCPcopy Index your code
hub / github.com/github/docs / injectDoctocatLinks

Function injectDoctocatLinks

tests/unit/mini-toc-items.js:11–16  ·  view source on GitHub ↗
(html)

Source from the content-addressed store, hash-verified

9// tag within the tag. Having to manually put that into every HTML
10// snippet in each test is tediuous so this function makes it convenient.
11function injectDoctocatLinks(html) {
12 let counter = 0
13 return html.replace(/<h\d>/g, (m) => {
14 return `${m}\n<a href="#section${++counter}" class="doctocat-link">🔗</a>\n`
15 })
16}
17
18describe('mini toc items', () => {
19 // Mock scenario from: /en/rest/reference/activity

Callers 1

mini-toc-items.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected