aboutsummaryrefslogtreecommitdiff
path: root/plugin/markdown
diff options
context:
space:
mode:
authorHakim El Hattab <hakim.elhattab@gmail.com>2013-09-06 08:40:43 -0400
committerHakim El Hattab <hakim.elhattab@gmail.com>2013-09-06 08:40:43 -0400
commitc453bc4770bfa0a84881822b27c79d046e718ffb (patch)
tree69e096ff5d766d13a11774c99ed1b2a4b21d626e /plugin/markdown
parentef9168c7c481805f57feb78853dfdd3dd1409705 (diff)
downloadfosdem-2018-presentation-c453bc4770bfa0a84881822b27c79d046e718ffb.tar
fosdem-2018-presentation-c453bc4770bfa0a84881822b27c79d046e718ffb.tar.gz
markdown plugin can now process slides that are added at runtime
Diffstat (limited to 'plugin/markdown')
-rwxr-xr-xplugin/markdown/markdown.js35
1 files changed, 25 insertions, 10 deletions
diff --git a/plugin/markdown/markdown.js b/plugin/markdown/markdown.js
index 739cc91..42c847f 100755
--- a/plugin/markdown/markdown.js
+++ b/plugin/markdown/markdown.js
@@ -9,9 +9,8 @@
}
else {
// Browser globals (root is window)
- root.returnExports = factory( root.marked );
- root.returnExports.processSlides();
- root.returnExports.convertSlides();
+ root.RevealMarkdown = factory( root.marked );
+ root.RevealMarkdown.initialize();
}
}( this, function( marked ) {
@@ -281,25 +280,41 @@
var section = sections[i];
- var notes = section.querySelector( 'aside.notes' );
- var markdown = getMarkdownFromSlide( section );
+ // Only parse the same slide once
+ if( !section.getAttribute( 'data-markdown-parsed' ) ) {
- section.innerHTML = marked( markdown );
+ section.setAttribute( 'data-markdown-parsed', true )
+
+ var notes = section.querySelector( 'aside.notes' );
+ var markdown = getMarkdownFromSlide( section );
+
+ section.innerHTML = marked( markdown );
+
+ // If there were notes, we need to re-add them after
+ // having overwritten the section's HTML
+ if( notes ) {
+ section.appendChild( notes );
+ }
- // If there were notes, we need to re-add them after
- // having overwritten the section's HTML
- if( notes ) {
- section.appendChild( notes );
}
}
}
+ // API
return {
+
+ initialize: function() {
+ processSlides();
+ convertSlides();
+ },
+
+ // TODO: Do these belong in the API?
processSlides: processSlides,
convertSlides: convertSlides,
slidify: slidify
+
};
}));