diff --git a/lib/utils/page.js b/lib/utils/page.js index a17c6a25f..2c5742133 100644 --- a/lib/utils/page.js +++ b/lib/utils/page.js @@ -244,14 +244,15 @@ function normalizeHtml(src, options) { .value(); var source = $(this).text(); - var html = options.book.template.applyBlock("code", { + var blk = options.book.template.applyBlock("code", { body: source, kwargs: { language: lang } - }).body; + }); - $(this).html(html); + if (blk.html === false) $(this).text(blk.body); + else $(this).html(blk.body); }); // Replace glossary terms diff --git a/test/codehighlighting.js b/test/codehighlighting.js index 5b3902b9f..9f392af09 100644 --- a/test/codehighlighting.js +++ b/test/codehighlighting.js @@ -56,7 +56,7 @@ describe("Code Highlighting", function () { it("should correctly replace highlighting for inline code with html tags", function() { PAGE.should.be.html({ "code": { - index: 2, + index: 3, text: "code__code" } }); diff --git a/test/plugins/replace_highlight/index.js b/test/plugins/replace_highlight/index.js index 2e8f71d4c..8586486d5 100644 --- a/test/plugins/replace_highlight/index.js +++ b/test/plugins/replace_highlight/index.js @@ -4,7 +4,10 @@ module.exports = { process: function(blk) { var lang = blk.kwargs.language || "code"; - return lang+"_"+blk.body+"_"+lang; + return { + body: lang+"_"+blk.body+"_"+lang, + html: false + }; } } }