From f94c3fc332c5a1a7584af7b3256f7d1b2b53d2a7 Mon Sep 17 00:00:00 2001 From: Steve Klabnik Date: Mon, 27 Feb 2017 15:10:16 -0500 Subject: [PATCH] Improve hidden code detection This doesn't _fix_ https://github.com/azerupi/mdBook/issues/155, but it does paper over it :wink: --- src/theme/book.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/theme/book.js b/src/theme/book.js index 8731880cec..4995abf7b8 100644 --- a/src/theme/book.js +++ b/src/theme/book.js @@ -147,7 +147,12 @@ $( document ).ready(function() { // Hide Rust code lines prepended with a specific character var hiding_character = "#"; - $("code.language-rust").each(function(i, block){ + $("code").each(function(i, block){ + var clss = $(this).attr("class"); + if(clss && !clss.includes("language-rust")) { + alert("zomg " + $(this).attr("class")); + return true; + } var code_block = $(this); var pre_block = $(this).parent();