Support markdown in speaker notes

It's pretty nice to have markdown in slides. It's even nicer to have
markdown in speaker notes too :)
This commit is contained in:
Josh Nichols 2012-09-08 22:05:19 -04:00
parent e6e80283f2
commit a8a3765bec
2 changed files with 11 additions and 2 deletions

View file

@ -27,7 +27,9 @@
indexv : event.indexv, indexv : event.indexv,
nextindexh : nextindexh, nextindexh : nextindexh,
nextindexv : nextindexv, nextindexv : nextindexv,
socketId : socketId socketId : socketId,
markdown : notes ? notes.getAttribute('data-markdown') != null : false
}; };
socket.emit('slidechanged', slideData); socket.emit('slidechanged', slideData);

View file

@ -87,6 +87,7 @@
<div id="notes"></div> <div id="notes"></div>
<script src="/socket.io/socket.io.js"></script> <script src="/socket.io/socket.io.js"></script>
<script src="/lib/js/showdown.js"></script>
<script> <script>
var socketId = '{{socketId}}'; var socketId = '{{socketId}}';
@ -99,7 +100,13 @@
// ignore data from sockets that aren't ours // ignore data from sockets that aren't ours
if (data.socketId !== socketId) { return; } if (data.socketId !== socketId) { return; }
if (data.markdown) {
notes.innerHTML = (new Showdown.converter()).makeHtml(data.notes);
}
else {
notes.innerHTML = data.notes; notes.innerHTML = data.notes;
}
currentSlide.contentWindow.Reveal.navigateTo(data.indexh, data.indexv); currentSlide.contentWindow.Reveal.navigateTo(data.indexh, data.indexv);
nextSlide.contentWindow.Reveal.navigateTo(data.nextindexh, data.nextindexv); nextSlide.contentWindow.Reveal.navigateTo(data.nextindexh, data.nextindexv);
}); });