@@ -792,7 +792,7 @@ fn build_header_links(html: &str) -> String {
792
792
static BUILD_HEADER_LINKS : Lazy < Regex > = Lazy :: new ( || {
793
793
Regex :: new ( r#"<h(\d)(?: id="([^"]+)")?(?: class="([^"]+)")?>(.*?)</h\d>"# ) . unwrap ( )
794
794
} ) ;
795
- static IGNORE_CLASS : & ' static [ & str ] = & [ "menu-title" ] ;
795
+ static IGNORE_CLASS : & [ & str ] = & [ "menu-title" ] ;
796
796
797
797
let mut id_counter = HashMap :: new ( ) ;
798
798
@@ -835,7 +835,7 @@ fn insert_link_into_header(
835
835
let classes = classes. unwrap_or ( "" . to_string ( ) ) ;
836
836
837
837
format ! (
838
- r##"<h{level} id="{id}" classes ="{classes}"><a class="header" href="#{id}">{text}</a></h{level}>"## ,
838
+ r##"<h{level} id="{id}" class ="{classes}"><a class="header" href="#{id}">{text}</a></h{level}>"## ,
839
839
level = level,
840
840
id = id,
841
841
text = content,
@@ -1014,27 +1014,31 @@ mod tests {
1014
1014
let inputs = vec ! [
1015
1015
(
1016
1016
"blah blah <h1>Foo</h1>" ,
1017
- r##"blah blah <h1 id="foo"><a class="header" href="#foo">Foo</a></h1>"## ,
1017
+ r##"blah blah <h1 id="foo" class="" ><a class="header" href="#foo">Foo</a></h1>"## ,
1018
1018
) ,
1019
1019
(
1020
1020
"<h1>Foo</h1>" ,
1021
- r##"<h1 id="foo"><a class="header" href="#foo">Foo</a></h1>"## ,
1021
+ r##"<h1 id="foo" class="" ><a class="header" href="#foo">Foo</a></h1>"## ,
1022
1022
) ,
1023
1023
(
1024
1024
"<h3>Foo^bar</h3>" ,
1025
- r##"<h3 id="foobar"><a class="header" href="#foobar">Foo^bar</a></h3>"## ,
1025
+ r##"<h3 id="foobar" class="" ><a class="header" href="#foobar">Foo^bar</a></h3>"## ,
1026
1026
) ,
1027
1027
(
1028
1028
"<h4></h4>" ,
1029
- r##"<h4 id=""><a class="header" href="#"></a></h4>"## ,
1029
+ r##"<h4 id="" class="" ><a class="header" href="#"></a></h4>"## ,
1030
1030
) ,
1031
1031
(
1032
1032
"<h4><em>Hï</em></h4>" ,
1033
- r##"<h4 id="hï"><a class="header" href="#hï"><em>Hï</em></a></h4>"## ,
1033
+ r##"<h4 id="hï" class="" ><a class="header" href="#hï"><em>Hï</em></a></h4>"## ,
1034
1034
) ,
1035
1035
(
1036
1036
"<h1>Foo</h1><h3>Foo</h3>" ,
1037
- r##"<h1 id="foo"><a class="header" href="#foo">Foo</a></h1><h3 id="foo-1"><a class="header" href="#foo-1">Foo</a></h3>"## ,
1037
+ r##"<h1 id="foo" class=""><a class="header" href="#foo">Foo</a></h1><h3 id="foo-1" class=""><a class="header" href="#foo-1">Foo</a></h3>"## ,
1038
+ ) ,
1039
+ (
1040
+ r##"<h1 id="foobar" class="class1 class2">Foo</h1>"## ,
1041
+ r##"<h1 id="foobar" class="class1 class2"><a class="header" href="#foobar">Foo</a></h1>"## ,
1038
1042
) ,
1039
1043
] ;
1040
1044
0 commit comments