@@ -901,7 +901,7 @@ fn hide_lines(html: &str, code_config: &Code) -> String {
901901 let classes = & caps[ 2 ] ;
902902 let code = & caps[ 3 ] ;
903903
904- if classes. contains ( "language-rust" ) {
904+ if classes. contains ( "language-rust" ) && code_config . default_hidelines {
905905 format ! (
906906 "<code class=\" {}\" >{}</code>" ,
907907 classes,
@@ -1311,6 +1311,35 @@ mod tests {
13111311 }
13121312 }
13131313
1314+ #[ test]
1315+ fn no_default_hide_lines ( ) {
1316+ let inputs = [
1317+ (
1318+ "<pre class=\" playground\" ><code class=\" language-rust\" >\n # #![allow(unused)]\n #fn main() {\n x()\n #}</code></pre>" ,
1319+ "<pre class=\" playground\" ><code class=\" language-rust\" >\n # #![allow(unused)]\n #fn main() {\n x()\n #}</code></pre>" , ) ,
1320+ (
1321+ "<pre class=\" playground\" ><code class=\" language-rust editable\" >let s = \" foo\n # bar\n \" ;</code></pre>" ,
1322+ "<pre class=\" playground\" ><code class=\" language-rust editable\" >let s = \" foo\n # bar\n \" ;</code></pre>" , ) ,
1323+ (
1324+ "<pre class=\" playground\" ><code class=\" language-rust editable\" >let s = \" foo\n ## bar\n \" ;</code></pre>" ,
1325+ "<pre class=\" playground\" ><code class=\" language-rust editable\" >let s = \" foo\n ## bar\n \" ;</code></pre>" , ) ,
1326+ (
1327+ "<pre class=\" playground\" ><code class=\" language-rust editable\" >let s = \" foo\n # bar\n #\n \" ;</code></pre>" ,
1328+ "<pre class=\" playground\" ><code class=\" language-rust editable\" >let s = \" foo\n # bar\n #\n \" ;</code></pre>" , ) ,
1329+ (
1330+ "<code class=\" language-rust ignore\" >let s = \" foo\n # bar\n \" ;</code>" ,
1331+ "<code class=\" language-rust ignore\" >let s = \" foo\n # bar\n \" ;</code>" , ) ,
1332+ ] ;
1333+ let code = Code {
1334+ hidelines : HashMap :: < String , String > :: default ( ) ,
1335+ default_hidelines : false ,
1336+ } ;
1337+ for ( src, should_be) in & inputs {
1338+ let got = hide_lines ( src, & code) ;
1339+ assert_eq ! ( & * got, * should_be) ;
1340+ }
1341+ }
1342+
13141343 #[ test]
13151344 fn test_json_direction ( ) {
13161345 assert_eq ! ( json!( TextDirection :: RightToLeft ) , json!( "rtl" ) ) ;
0 commit comments