Support markdown in speaker notes
authorJosh Nichols <josh@technicalpickles.com>
Sun, 9 Sep 2012 02:05:19 +0000 (22:05 -0400)
committerJosh Nichols <josh@technicalpickles.com>
Sun, 9 Sep 2012 02:07:14 +0000 (22:07 -0400)
It's pretty nice to have markdown in slides. It's even nicer to have
markdown in speaker notes too :)

plugin/speakernotes/client.js
plugin/speakernotes/notes.html

index 1aba8b8c29837fb5780ff538958bce0583714478..9e657d6361ead481c4a9f3c7f10550694d1908f4 100644 (file)
@@ -27,7 +27,9 @@
                        indexv : event.indexv,
                        nextindexh : nextindexh,
                        nextindexv : nextindexv,
-                       socketId : socketId
+                       socketId : socketId,
+                       markdown : notes ? notes.getAttribute('data-markdown') != null : false
+
                };
 
                socket.emit('slidechanged', slideData);
index 88924c0d663b98637a46456d381a33827361f527..f61501d74ffa56ea2bce600fafdf38fc68753b9d 100644 (file)
@@ -87,6 +87,7 @@
                <div id="notes"></div>
 
                <script src="/socket.io/socket.io.js"></script>
+                <script src="/lib/js/showdown.js"></script>
 
                <script>
                var socketId = '{{socketId}}';
                        // ignore data from sockets that aren't ours
                        if (data.socketId !== socketId) { return; }
 
-                       notes.innerHTML = data.notes;
+                        if (data.markdown) {
+                          notes.innerHTML = (new Showdown.converter()).makeHtml(data.notes);
+                        }
+                        else {
+                          notes.innerHTML = data.notes;
+                        }
+
                        currentSlide.contentWindow.Reveal.navigateTo(data.indexh, data.indexv);
                        nextSlide.contentWindow.Reveal.navigateTo(data.nextindexh, data.nextindexv);
                });