|
@@ -2,13 +2,15 @@
|
|
|
// Modified by Hakim to handle Markdown indented with tabs
|
|
|
(function(){
|
|
|
|
|
|
- var slides = document.querySelectorAll('[data-markdown]');
|
|
|
+ var sections = document.querySelectorAll( '[data-markdown]' );
|
|
|
|
|
|
- for( var i = 0, len = slides.length; i < len; i++ ) {
|
|
|
- var elem = slides[i];
|
|
|
+ for( var i = 0, len = sections.length; i < len; i++ ) {
|
|
|
+ var section = sections[i];
|
|
|
+
|
|
|
+ var template = section.querySelector( 'script' );
|
|
|
|
|
|
// strip leading whitespace so it isn't evaluated as code
|
|
|
- var text = elem.innerHTML;
|
|
|
+ var text = ( template || section ).innerHTML;
|
|
|
|
|
|
var leadingWs = text.match(/^\n?(\s*)/)[1].length,
|
|
|
leadingTabs = text.match(/^\n?(\t*)/)[1].length;
|
|
@@ -20,8 +22,7 @@
|
|
|
text = text.replace( new RegExp('\\n? {' + leadingWs + '}','g'), '\n' );
|
|
|
}
|
|
|
|
|
|
- // here, have sum HTML
|
|
|
- elem.innerHTML = (new Showdown.converter()).makeHtml(text);
|
|
|
+ section.innerHTML = (new Showdown.converter()).makeHtml(text);
|
|
|
}
|
|
|
|
|
|
})();
|