aboutsummaryrefslogtreecommitdiff
path: root/plugin
diff options
context:
space:
mode:
authorBenjamin Tan <demoneaux@gmail.com>2016-12-08 17:41:55 +0800
committerBenjamin Tan <demoneaux@gmail.com>2016-12-08 17:41:55 +0800
commit90b301d0a03b8b23ce755c31ec6dac15cf69dc49 (patch)
tree6079937a9f78770c1bf291da38716782f0ac6e5a /plugin
parent2bd6b563be65bb0ff95593b30572ca72fd3e8b77 (diff)
downloadfosdem-2018-presentation-90b301d0a03b8b23ce755c31ec6dac15cf69dc49.tar
fosdem-2018-presentation-90b301d0a03b8b23ce755c31ec6dac15cf69dc49.tar.gz
Enable passing options for parsing Markdown.
Closes #1163, #1495.
Diffstat (limited to 'plugin')
-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 124aa75..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( code, lang ) {
- return hljs.highlightAuto( code, [lang] ).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();
},