@@ -559,7 +559,15 @@ function hideThemeButtonState() {
559559 others . appendChild ( div ) ;
560560 }
561561
562- function block ( shortty , longty ) {
562+ /**
563+ * Append to the sidebar a "block" of links - a heading along with a list (`<ul>`) of items.
564+ *
565+ * @param {string } shortty - A short type name, like "primitive", "mod", or "macro"
566+ * @param {string } id - The HTML id of the corresponding section on the module page.
567+ * @param {string } longty - A long, capitalized, plural name, like "Primitive Types",
568+ * "Modules", or "Macros".
569+ */
570+ function block ( shortty , id , longty ) {
563571 var filtered = items [ shortty ] ;
564572 if ( ! filtered ) {
565573 return ;
@@ -568,7 +576,7 @@ function hideThemeButtonState() {
568576 var div = document . createElement ( "div" ) ;
569577 div . className = "block " + shortty ;
570578 var h3 = document . createElement ( "h3" ) ;
571- h3 . textContent = longty ;
579+ h3 . innerHTML = `<a href="index.html# ${ id } "> ${ longty } </a>` ;
572580 div . appendChild ( h3 ) ;
573581 var ul = document . createElement ( "ul" ) ;
574582
@@ -607,20 +615,20 @@ function hideThemeButtonState() {
607615
608616 var isModule = hasClass ( document . body , "mod" ) ;
609617 if ( ! isModule ) {
610- block ( "primitive" , "Primitive Types" ) ;
611- block ( "mod" , "Modules" ) ;
612- block ( "macro" , "Macros" ) ;
613- block ( "struct" , "Structs" ) ;
614- block ( "enum" , "Enums" ) ;
615- block ( "union" , "Unions" ) ;
616- block ( "constant" , "Constants" ) ;
617- block ( "static" , "Statics" ) ;
618- block ( "trait" , "Traits" ) ;
619- block ( "fn" , "Functions" ) ;
620- block ( "type" , "Type Definitions" ) ;
621- block ( "foreigntype" , "Foreign Types" ) ;
622- block ( "keyword" , "Keywords" ) ;
623- block ( "traitalias" , "Trait Aliases" ) ;
618+ block ( "primitive" , "primitives" , " Primitive Types") ;
619+ block ( "mod" , "modules" , " Modules") ;
620+ block ( "macro" , "macros" , " Macros") ;
621+ block ( "struct" , "structs" , " Structs") ;
622+ block ( "enum" , "enums" , " Enums") ;
623+ block ( "union" , "unions" , " Unions") ;
624+ block ( "constant" , "constants" , " Constants") ;
625+ block ( "static" , "static" , " Statics") ;
626+ block ( "trait" , "traits" , " Traits") ;
627+ block ( "fn" , "functions" , " Functions") ;
628+ block ( "type" , "types" , " Type Definitions") ;
629+ block ( "foreigntype" , "foreign-types" , " Foreign Types") ;
630+ block ( "keyword" , "keywords" , " Keywords") ;
631+ block ( "traitalias" , "trait-aliases" , " Trait Aliases") ;
624632 }
625633
626634 // `crates{version}.js` should always be loaded before this script, so we can use
0 commit comments