From a8a3765bec9a490b285f3422be2dd06e5acb65d4 Mon Sep 17 00:00:00 2001
From: Josh Nichols <josh@technicalpickles.com>
Date: Sat, 8 Sep 2012 22:05:19 -0400
Subject: [PATCH] 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 :)
---
 plugin/speakernotes/client.js  | 4 +++-
 plugin/speakernotes/notes.html | 9 ++++++++-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/plugin/speakernotes/client.js b/plugin/speakernotes/client.js
index 1aba8b8..9e657d6 100644
--- a/plugin/speakernotes/client.js
+++ b/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);
diff --git a/plugin/speakernotes/notes.html b/plugin/speakernotes/notes.html
index 88924c0..f61501d 100644
--- a/plugin/speakernotes/notes.html
+++ b/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);
 		});
-- 
GitLab