Merge branch 'bug/markdown' of https://github.com/snowyu/reveal.js into dev

This commit is contained in:
Hakim El Hattab 2013-07-31 08:37:53 -04:00
commit fe90f2b8c7

View File

@ -6,6 +6,14 @@
throw 'The reveal.js Markdown plugin requires marked to be loaded'; 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 stripLeadingWhitespace = function(section) {
var template = section.querySelector( 'script' ); var template = section.querySelector( 'script' );
@ -28,7 +36,7 @@
}; };
var twrap = function(el) { var twrap = function(el) {
return '<script type="text/template">' + el + '</script>'; return marked(el);
}; };
var getForwardedAttributes = function(section) { var getForwardedAttributes = function(section) {
@ -51,7 +59,7 @@
} }
return result.join( ' ' ); return result.join( ' ' );
} };
var slidifyMarkdown = function(markdown, separator, vertical, attributes) { var slidifyMarkdown = function(markdown, separator, vertical, attributes) {
@ -101,12 +109,12 @@
for( var k = 0, klen = sectionStack.length; k < klen; k++ ) { for( var k = 0, klen = sectionStack.length; k < klen; k++ ) {
// horizontal // horizontal
if( typeof sectionStack[k] === 'string' ) { if( typeof sectionStack[k] === 'string' ) {
markdownSections += '<section '+ attributes +' data-markdown>' + twrap( sectionStack[k] ) + '</section>'; markdownSections += '<section '+ attributes +'>' + twrap( sectionStack[k] ) + '</section>';
} }
// vertical // vertical
else { else {
markdownSections += '<section '+ attributes +'>' + markdownSections += '<section '+ attributes +'>' +
'<section data-markdown>' + sectionStack[k].map(twrap).join('</section><section data-markdown>') + '</section>' + '<section>' + sectionStack[k].map(twrap).join('</section><section>') + '</section>' +
'</section>'; '</section>';
} }
} }