File tree Expand file tree Collapse file tree 1 file changed +2
-5
lines changed Expand file tree Collapse file tree 1 file changed +2
-5
lines changed Original file line number Diff line number Diff line change 2020 var links = { }
2121 var list = headings . reduce ( function ( accum , heading ) {
2222 var link = document . createElement ( 'a' )
23- var headingWithoutLabels = heading . cloneNode ( true )
24- if ( headingWithoutLabels . querySelector ( 'span.label' ) != null ) {
25- headingWithoutLabels . removeChild ( headingWithoutLabels . querySelector ( 'span.label' ) )
26- }
27- link . textContent = headingWithoutLabels . textContent
23+ var headingTextWithoutLabels = Array . from ( heading . childNodes ) . filter ( ( el ) => el . nodeType === Node . TEXT_NODE ) . map ( ( el ) => el . textContent ) . join ( ' ' ) . trim ( )
24+ link . textContent = headingTextWithoutLabels
2825 links [ ( link . href = '#' + heading . id ) ] = link
2926 var listItem = document . createElement ( 'li' )
3027 listItem . dataset . level = parseInt ( heading . nodeName . slice ( 1 ) ) - 1
You can’t perform that action at this time.
0 commit comments