@@ -956,7 +956,7 @@ fn hide_lines(html: &str, code_config: &Code) -> String {
956956            let  classes = & caps[ 2 ] ; 
957957            let  code = & caps[ 3 ] ; 
958958
959-             if  classes. contains ( "language-rust" )  { 
959+             if  classes. contains ( "language-rust" )  && code_config . default_hidelines   { 
960960                format ! ( 
961961                    "<code class=\" {}\" >{}</code>" , 
962962                    classes, 
@@ -1283,6 +1283,38 @@ mod tests {
12831283                        map. insert ( "python" . to_string ( ) ,  "~" . to_string ( ) ) ; 
12841284                        map
12851285                    } , 
1286+                     default_hidelines :  true , 
1287+                 } , 
1288+             ) ; 
1289+             assert_eq ! ( & * got,  * should_be) ; 
1290+         } 
1291+     } 
1292+ 
1293+     #[ test]  
1294+     fn  no_default_hide_lines ( )  { 
1295+         let  inputs = [ 
1296+           ( 
1297+            "<pre class=\" playground\" ><code class=\" language-rust\" >\n # #![allow(unused)]\n #fn main() {\n x()\n #}</code></pre>" , 
1298+            "<pre class=\" playground\" ><code class=\" language-rust\" >\n # #![allow(unused)]\n #fn main() {\n x()\n #}</code></pre>" , ) , 
1299+           ( 
1300+            "<pre class=\" playground\" ><code class=\" language-rust editable\" >let s = \" foo\n  # bar\n \" ;</code></pre>" , 
1301+            "<pre class=\" playground\" ><code class=\" language-rust editable\" >let s = \" foo\n  # bar\n \" ;</code></pre>" , ) , 
1302+           ( 
1303+            "<pre class=\" playground\" ><code class=\" language-rust editable\" >let s = \" foo\n  ## bar\n \" ;</code></pre>" , 
1304+            "<pre class=\" playground\" ><code class=\" language-rust editable\" >let s = \" foo\n  ## bar\n \" ;</code></pre>" , ) , 
1305+           ( 
1306+            "<pre class=\" playground\" ><code class=\" language-rust editable\" >let s = \" foo\n  # bar\n #\n \" ;</code></pre>" , 
1307+            "<pre class=\" playground\" ><code class=\" language-rust editable\" >let s = \" foo\n  # bar\n #\n \" ;</code></pre>" , ) , 
1308+           ( 
1309+            "<code class=\" language-rust ignore\" >let s = \" foo\n  # bar\n \" ;</code>" , 
1310+            "<code class=\" language-rust ignore\" >let s = \" foo\n  # bar\n \" ;</code>" , ) , 
1311+         ] ; 
1312+         for  ( src,  should_be)  in  & inputs { 
1313+             let  got = hide_lines ( 
1314+                 src, 
1315+                 & Code  { 
1316+                     hidelines :  HashMap :: < String ,  String > :: default ( ) , 
1317+                     default_hidelines :  false , 
12861318                } , 
12871319            ) ; 
12881320            assert_eq ! ( & * got,  * should_be) ; 
0 commit comments