Skip to content

Commit

Permalink
Merge branch 'markdown-in-notes' of https://github.com/technicalpickl…
Browse files Browse the repository at this point in the history
  • Loading branch information
hakimel committed Sep 21, 2012
2 parents c904cef + df2ebc5 commit c5fe9bd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ If you're interested in using speaker notes, reveal.js comes with a Node server

To include speaker notes in your presentation, simply add an `<aside class="notes">` element to any slide. These notes will be hidden in the main presentation view.

It's also possible to write your notes with Markdown. To enable Markdown, simply add the ```data-markdown``` attribute to your ```<aside>``` elements and reveal.js will automatically load the JavaScript parser.

You'll also need to [install Node.js](http://nodejs.org/); then, install the server dependencies by running `npm install`.

Once Node.js and the dependencies are installed, run the following command from the root directory:
Expand All @@ -229,4 +231,4 @@ You can change the appearance of the speaker notes by editing the file at `plugi

MIT licensed

Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se
Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se
4 changes: 3 additions & 1 deletion plugin/speakernotes/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@
indexv : event.indexv,
nextindexh : nextindexh,
nextindexv : nextindexv,
socketId : socketId
socketId : socketId,
markdown : notes ? notes.getAttribute('data-markdown') != null : false

};

socket.emit('slidechanged', slideData);
Expand Down
9 changes: 8 additions & 1 deletion plugin/speakernotes/notes.html
Original file line number Diff line number Diff line change
Expand Up @@ -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}}';
Expand All @@ -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);
});
Expand Down

0 comments on commit c5fe9bd

Please sign in to comment.