diff --git a/src/theme/book.css b/src/theme/book.css index c73eb4a0..df72378b 100644 --- a/src/theme/book.css +++ b/src/theme/book.css @@ -9,6 +9,9 @@ body { .right { float: right; } +.hidden { + display: none; +} h2, h3 { margin-top: 2.5em; diff --git a/src/theme/book.js b/src/theme/book.js index 862cb324..b4809118 100644 --- a/src/theme/book.js +++ b/src/theme/book.js @@ -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] = "" + lines[n] + "" + lines[n] = "" + lines[n] + ""; + } + 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("")); }); diff --git a/src/theme/stylus/general.styl b/src/theme/stylus/general.styl index 13f616f6..e798e8e0 100644 --- a/src/theme/stylus/general.styl +++ b/src/theme/stylus/general.styl @@ -11,4 +11,8 @@ html, body { float: right } +.hidden { + display: none; +} + h2, h3 { margin-top: 2.5em }