Hides rust code lines prepended with #
This commit is contained in:
parent
d6d0979ecf
commit
0620ef1f47
|
@ -9,6 +9,9 @@ body {
|
|||
.right {
|
||||
float: right;
|
||||
}
|
||||
.hidden {
|
||||
display: none;
|
||||
}
|
||||
h2,
|
||||
h3 {
|
||||
margin-top: 2.5em;
|
||||
|
|
|
@ -119,13 +119,20 @@ $( document ).ready(function() {
|
|||
|
||||
$("code.language-rust").each(function(i, block){
|
||||
var lines = $(this).html().split("\n");
|
||||
var first_non_hidden_line = false;
|
||||
|
||||
for(var n = 0; n < lines.length; n++){
|
||||
if($.trim(lines[n])[0] == hiding_character){
|
||||
lines[n] = "<span class=\"hidden\">" + lines[n] + "</span>"
|
||||
lines[n] = "<span class=\"hidden\">" + lines[n] + "</span>";
|
||||
}
|
||||
else if(first_non_hidden_line) {
|
||||
lines[n] = "\n" + lines[n];
|
||||
}
|
||||
else {
|
||||
first_non_hidden_line = true;
|
||||
}
|
||||
}
|
||||
$(this).html(lines.join());
|
||||
$(this).html(lines.join(""));
|
||||
});
|
||||
|
||||
|
||||
|
|
|
@ -11,4 +11,8 @@ html, body {
|
|||
float: right
|
||||
}
|
||||
|
||||
.hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
h2, h3 { margin-top: 2.5em }
|
||||
|
|
Loading…
Reference in New Issue