summaryrefslogtreecommitdiffstats
path: root/lib/utils/page.js
diff options
context:
space:
mode:
authorSamy Pesse <samypesse@gmail.com>2015-09-14 11:21:16 +0200
committerSamy Pesse <samypesse@gmail.com>2015-09-14 11:21:16 +0200
commit35c4179ca12a0287279ced0535f11237cdf606ec (patch)
tree3c33389aee37d515b2fed396f57a7cefb2eb8cad /lib/utils/page.js
parent601ce3add380392fe9c1d598e01f05034ff058c3 (diff)
downloadgitbook-35c4179ca12a0287279ced0535f11237cdf606ec.zip
gitbook-35c4179ca12a0287279ced0535f11237cdf606ec.tar.gz
gitbook-35c4179ca12a0287279ced0535f11237cdf606ec.tar.bz2
Use block code for highlight pre/code
Cleanup correctly predefined blocks
Diffstat (limited to 'lib/utils/page.js')
-rw-r--r--lib/utils/page.js9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/utils/page.js b/lib/utils/page.js
index 2400480..c4af715 100644
--- a/lib/utils/page.js
+++ b/lib/utils/page.js
@@ -223,7 +223,7 @@ function normalizeHtml(src, options) {
// Highlight code blocks
$("code").each(function() {
- // Extract language
+ // Normalize language
var lang = _.chain(
($(this).attr("class") || "").split(" ")
)
@@ -240,11 +240,10 @@ function normalizeHtml(src, options) {
.first()
.value();
- if (lang) {
- var html = $(this).text();
+ var source = $(this).text();
+ var html = options.book.template.applyBlock('code', source).body;
- $(this).html(html);
- }
+ $(this).html(html);
});
// Replace glossary terms