@@ -197,10 +197,9 @@ class DOMService {
197197 }
198198
199199 createFolderHeaderWithFile ( iconClass , doc ) {
200- const iconStyle = doc . color ? `color: ${ doc . color } ;` : '' ;
201200 return `
202201 <div class="folder-icons">
203- <i class="${ iconClass } folder-icon" style=" ${ iconStyle } " ></i>
202+ <i class="${ iconClass } folder-icon"></i>
204203 </div>
205204 <span>${ doc . title } </span>
206205 <a href="?${ doc . slug } " class="folder-link" title="View folder page">
@@ -209,10 +208,9 @@ class DOMService {
209208 }
210209
211210 createFolderHeaderBasic ( iconClass , doc ) {
212- const iconStyle = doc . color ? `color: ${ doc . color } ;` : '' ;
213211 return `
214212 <div class="folder-icons">
215- <i class="${ iconClass } folder-icon" style=" ${ iconStyle } " ></i>
213+ <i class="${ iconClass } folder-icon"></i>
216214 </div>
217215 <span>${ doc . title } </span>` ;
218216 }
@@ -346,6 +344,20 @@ class DocumentService {
346344 }
347345 return link . replace ( / ^ < a / , `<a${ attrs } ` ) ;
348346 } ;
347+
348+ // Add custom heading renderer to make headers clickable - without link icon
349+ const originalHeading = renderer . heading . bind ( renderer ) ;
350+ renderer . heading = ( text , level ) => {
351+ const escapedText = text . toLowerCase ( )
352+ . replace ( / [ ^ \w \s - ] / g, '' )
353+ . replace ( / \s + / g, '-' ) ;
354+
355+ const id = escapedText ;
356+
357+ return `<h${ level } id="${ id } " class="clickable-header">
358+ ${ text }
359+ </h${ level } >` ;
360+ } ;
349361 }
350362
351363 renderCode ( code , language ) {
@@ -540,17 +552,6 @@ class Documentation {
540552 const data = await response . json ( ) ;
541553 this . indexData = data ;
542554 window . _indexData = data ;
543-
544- // Load custom CSS files if specified
545- if ( data . customCSS ) {
546- const cssFiles = Array . isArray ( data . customCSS ) ? data . customCSS : [ data . customCSS ] ;
547- cssFiles . forEach ( cssFile => {
548- const link = document . createElement ( 'link' ) ;
549- link . rel = 'stylesheet' ;
550- link . href = cssFile ;
551- document . head . appendChild ( link ) ;
552- } ) ;
553- }
554555
555556 this . populateAuthorInfo ( data . author ) ;
556557 window . originalDocTitle = data . metadata . site_name || 'Documentation' ;
@@ -636,6 +637,23 @@ class Documentation {
636637 const headings = document . querySelectorAll ( 'h2, h3, h4, h5, h6' ) ;
637638 const headingLinks = this . domService . createOutline ( headings ) ;
638639
640+ // Add click handlers to all headers
641+ headings . forEach ( heading => {
642+ heading . addEventListener ( 'click' , ( e ) => {
643+ // Don't trigger if clicking on fold toggle
644+ if ( e . target . closest ( 'svg' ) || e . target . closest ( '.header-anchor' ) ) return ;
645+
646+ const id = heading . id ;
647+ if ( id ) {
648+ history . pushState ( null , '' , `${ window . location . pathname } ${ window . location . search } #${ id } ` ) ;
649+ this . domService . scrollToElement ( heading ) ;
650+ heading . classList . remove ( 'highlight' ) ;
651+ void heading . offsetWidth ;
652+ heading . classList . add ( 'highlight' ) ;
653+ }
654+ } ) ;
655+ } ) ;
656+
639657 this . setupScrollObserver ( headings , headingLinks ) ;
640658
641659 window . _currentPath = path ;
0 commit comments