The code on the lines prepended with a # are hidden, the space of the line remains because of the '\n' in <pre> tag

This commit is contained in:
Mathieu David 2015-12-28 23:52:05 +01:00
parent 159b300067
commit d6d0979ecf
1 changed files with 17 additions and 0 deletions

View File

@ -112,4 +112,21 @@ $( document ).ready(function() {
$('body').removeClass().addClass(theme); $('body').removeClass().addClass(theme);
} }
// Hide Rust code lines prepended with a specific character
var hiding_character = "#";
$("code.language-rust").each(function(i, block){
var lines = $(this).html().split("\n");
for(var n = 0; n < lines.length; n++){
if($.trim(lines[n])[0] == hiding_character){
lines[n] = "<span class=\"hidden\">" + lines[n] + "</span>"
}
}
$(this).html(lines.join());
});
}); });