summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron O'Mullan <aaron.omullan@friendco.de>2014-04-16 13:07:35 -0700
committerAaron O'Mullan <aaron.omullan@friendco.de>2014-04-16 13:07:35 -0700
commit9e4b393b7a77b3fa782edfb2ced0f5776f05997c (patch)
treeba6f957d9613c13a681faee85afe6104733595fc
parenta0ae34a3b7d5da3ba8302022cb66a975efdba7ab (diff)
downloadgitbook-9e4b393b7a77b3fa782edfb2ced0f5776f05997c.zip
gitbook-9e4b393b7a77b3fa782edfb2ced0f5776f05997c.tar.gz
gitbook-9e4b393b7a77b3fa782edfb2ced0f5776f05997c.tar.bz2
In parse/page remove global marked settings
Highlighter settings were global, moved them to the render function (where they should have been)
-rw-r--r--lib/parse/page.js22
1 files changed, 10 insertions, 12 deletions
diff --git a/lib/parse/page.js b/lib/parse/page.js
index eb118e4..efadf82 100644
--- a/lib/parse/page.js
+++ b/lib/parse/page.js
@@ -8,17 +8,6 @@ var renderer = require('./renderer');
var lnormalize = require('../utils/lang').normalize;
-// Synchronous highlighting with highlight.js
-marked.setOptions({
- highlight: function (code, lang) {
- try {
- return hljs.highlight(lang, code).value;
- } catch(e) {
- return hljs.highlightAuto(code).value;
- }
- }
-});
-
// Render a section using our custom renderer
function render(section, _options) {
@@ -30,7 +19,16 @@ function render(section, _options) {
// Build options using defaults and our custom renderer
var options = _.extend({}, marked.defaults, {
- renderer: renderer(null, _options)
+ renderer: renderer(null, _options),
+
+ // Synchronous highlighting with highlight.js
+ highlight: function (code, lang) {
+ try {
+ return hljs.highlight(lang, code).value;
+ } catch(e) {
+ return hljs.highlightAuto(code).value;
+ }
+ }
});
return marked.parser(section, options);