Преглед на файлове

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 :)
Josh Nichols преди 11 години
родител
ревизия
a8a3765bec
променени са 2 файла, в които са добавени 11 реда и са изтрити 2 реда
  1. 3 1
      plugin/speakernotes/client.js
  2. 8 1
      plugin/speakernotes/notes.html

+ 3 - 1
plugin/speakernotes/client.js

@@ -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);

+ 8 - 1
plugin/speakernotes/notes.html

@@ -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}}';
@@ -99,7 +100,13 @@
 			// 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);
 		});