summaryrefslogtreecommitdiffhomepage
path: root/plugin/markdown/markdown.js
diff options
context:
space:
mode:
authorHakim El Hattab2017-01-10 13:45:52 +0100
committerHakim El Hattab2017-01-10 13:45:52 +0100
commita144134b42c15964f469cf4499859268f52ccb46 (patch)
tree7ef37dadc82e5726e249e5677ec0125691581a75 /plugin/markdown/markdown.js
parent713702a0ab81d1756a30e6c14ae49afd42135541 (diff)
parent97bb6e9b584f6b4eee33c91e04e5a40da358b7cd (diff)
Merge branch 'dev' of github.com:hakimel/reveal.js
Diffstat (limited to 'plugin/markdown/markdown.js')
-rwxr-xr-xplugin/markdown/markdown.js32
1 files changed, 19 insertions, 13 deletions
diff --git a/plugin/markdown/markdown.js b/plugin/markdown/markdown.js
index ad596bf..29aabf5 100755
--- a/plugin/markdown/markdown.js
+++ b/plugin/markdown/markdown.js
@@ -17,18 +17,6 @@
}
}( this, function( marked ) {
- if( typeof marked === 'undefined' ) {
- 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 DEFAULT_SLIDE_SEPARATOR = '^\r?\n---\r?\n$',
DEFAULT_NOTES_SEPARATOR = 'note:',
DEFAULT_ELEMENT_ATTRIBUTES_SEPARATOR = '\\\.element\\\s*?(.+?)$',
@@ -189,7 +177,7 @@
markdownSections += '<section '+ options.attributes +'>';
sectionStack[i].forEach( function( child ) {
- markdownSections += '<section data-markdown>' + createMarkdownSlide( child, options ) + '</section>';
+ markdownSections += '<section data-markdown>' + createMarkdownSlide( child, options ) + '</section>';
} );
markdownSections += '</section>';
@@ -391,6 +379,24 @@
return {
initialize: function() {
+ if( typeof marked === 'undefined' ) {
+ throw 'The reveal.js Markdown plugin requires marked to be loaded';
+ }
+
+ if( typeof hljs !== 'undefined' ) {
+ marked.setOptions({
+ highlight: function( code, lang ) {
+ return hljs.highlightAuto( code, [lang] ).value;
+ }
+ });
+ }
+
+ var options = Reveal.getConfig().markdown;
+
+ if ( options ) {
+ marked.setOptions( options );
+ }
+
processSlides();
convertSlides();
},