summaryrefslogtreecommitdiffstats
path: root/lib/page/index.js
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2016-02-14 15:26:15 +0100
committerSamy Pessé <samypesse@gmail.com>2016-02-14 15:26:15 +0100
commit0e86cdeb4a3af445700e8e3ebbdb245e16581c17 (patch)
tree41b5e10b7bb5120f3e43920370aeafda755a5322 /lib/page/index.js
parenta65f888a77c48968087d23750e5fa4d55f2a8686 (diff)
downloadgitbook-0e86cdeb4a3af445700e8e3ebbdb245e16581c17.zip
gitbook-0e86cdeb4a3af445700e8e3ebbdb245e16581c17.tar.gz
gitbook-0e86cdeb4a3af445700e8e3ebbdb245e16581c17.tar.bz2
Add code blocks normalization
Diffstat (limited to 'lib/page/index.js')
-rw-r--r--lib/page/index.js12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/page/index.js b/lib/page/index.js
index 77b9950..2a4553f 100644
--- a/lib/page/index.js
+++ b/lib/page/index.js
@@ -144,7 +144,17 @@ Page.prototype.parse = function(output) {
var pipelineOpts = {
onRelativeLink: _.partial(output.onRelativeLink, that),
onImage: _.partial(output.onOutputImage, that),
- onOutputSVG: _.partial(output.onOutputSVG, that)
+ onOutputSVG: _.partial(output.onOutputSVG, that),
+
+ // Use 'code' template block
+ onCodeBlock: function(source, lang) {
+ return output.template.applyBlock('code', {
+ body: source,
+ kwargs: {
+ language: lang
+ }
+ });
+ }
};
var pipeline = new HTMLPipeline(that.content, pipelineOpts);