diff --git a/src/theme/book.js b/src/theme/book.js
index 52be9a9d..424bac56 100644
--- a/src/theme/book.js
+++ b/src/theme/book.js
@@ -146,10 +146,10 @@ $( document ).ready(function() {
for(var n = 0; n < lines.length; n++){
if($.trim(lines[n])[0] == hiding_character){
if(first_non_hidden_line){
- lines[n] = "" + "\n" + lines[n].replace(/(\s*)#/, "$1") + "";
+ lines[n] = "" + "\n" + lines[n].replace(/(\s*)# ?/, "$1") + "";
}
else {
- lines[n] = "" + lines[n].replace(/(\s*)#/, "$1") + "\n" + "";
+ lines[n] = "" + lines[n].replace(/(\s*)# ?/, "$1") + "\n" + "";
}
lines_hidden = true;
}