From: Riceball LEE Date: Tue, 30 Jul 2013 22:48:09 +0000 (+0800) Subject: * [bug] fixed render markdown file error like this: X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=efbcab57f74891a060320af1c9e2e3c039febc5a;p=reveal.js.git * [bug] fixed render markdown file error like this: ```html
``` --- diff --git a/plugin/markdown/markdown.js b/plugin/markdown/markdown.js index 473666b..dcab2fa 100755 --- a/plugin/markdown/markdown.js +++ b/plugin/markdown/markdown.js @@ -6,6 +6,14 @@ throw 'The reveal.js Markdown plugin requires marked to be loaded'; } + if (typeof hljs !== 'undefined') { + marked.setOptions({ + highlight: function (lang, code) { + return hljs.highlightAuto(lang, code).value; + } + }); + } + var stripLeadingWhitespace = function(section) { var template = section.querySelector( 'script' ); @@ -28,7 +36,7 @@ }; var twrap = function(el) { - return ''; + return marked(el); }; var getForwardedAttributes = function(section) { @@ -51,7 +59,7 @@ } return result.join( ' ' ); - } + }; var slidifyMarkdown = function(markdown, separator, vertical, attributes) { @@ -101,12 +109,12 @@ for( var k = 0, klen = sectionStack.length; k < klen; k++ ) { // horizontal if( typeof sectionStack[k] === 'string' ) { - markdownSections += '
' + twrap( sectionStack[k] ) + '
'; + markdownSections += '
' + twrap( sectionStack[k] ) + '
'; } // vertical else { markdownSections += '
' + - '
' + sectionStack[k].map(twrap).join('
') + '
' + + '
' + sectionStack[k].map(twrap).join('
') + '
' + '
'; } }