1 # reveal.js [![Build Status](https://travis-ci.org/hakimel/reveal.js.png?branch=master)](https://travis-ci.org/hakimel/reveal.js)
3 A framework for easily creating beautiful presentations using HTML. [Check out the live demo](http://lab.hakim.se/reveal-js/).
5 reveal.js comes with a broad range of features including [nested slides](https://github.com/hakimel/reveal.js#markup), [markdown contents](https://github.com/hakimel/reveal.js#markdown), [PDF export](https://github.com/hakimel/reveal.js#pdf-export), [speaker notes](https://github.com/hakimel/reveal.js#speaker-notes) and a [JavaScript API](https://github.com/hakimel/reveal.js#api). It's best viewed in a browser with support for CSS 3D transforms but [fallbacks](https://github.com/hakimel/reveal.js/wiki/Browser-Support) are available to make sure your presentation can still be viewed elsewhere.
8 #### More reading in the Wiki:
9 - [Changelog](https://github.com/hakimel/reveal.js/wiki/Changelog): Up-to-date version history.
10 - [Examples](https://github.com/hakimel/reveal.js/wiki/Example-Presentations): Presentations created with reveal.js, add your own!
11 - [Browser Support](https://github.com/hakimel/reveal.js/wiki/Browser-Support): Explanation of browser support and fallbacks.
15 Slides are written using HTML or markdown but there's also an online editor for those of you who prefer a more traditional user interface. Give it a try at [www.rvl.io](http://www.rvl.io).
22 Markup heirarchy needs to be ``<div class="reveal"> <div class="slides"> <section>`` where the ``<section>`` represents one slide and can be repeated indefinitely. If you place multiple ``<section>``'s inside of another ``<section>`` they will be shown as vertical slides. The first of the vertical slides is the "root" of the others (at the top), and it will be included in the horizontal sequence. For example:
27 <section>Single Horizontal Slide</section>
29 <section>Vertical Slide 1</section>
30 <section>Vertical Slide 2</section>
38 It's possible to write your slides using Markdown. To enable Markdown, add the ```data-markdown``` attribute to your ```<section>``` elements and wrap the contents in a ```<script type="text/template">``` like the example below.
40 This is based on [data-markdown](https://gist.github.com/1343518) from [Paul Irish](https://github.com/paulirish) which in turn uses [showdown](https://github.com/coreyti/showdown/). Sensitive to indentation (avoid mixing tabs and spaces) and line breaks (avoid consecutive breaks).
43 <section data-markdown>
44 <script type="text/template">
47 A paragraph with some text and a [link](http://hakim.se).
52 #### External Markdown
54 You can write your content as a separate file and have reveal.js load it at runtime. Note the separator arguments which determine how slides are delimited in the external file.
57 <section data-markdown="example.md" data-separator="^\n\n\n" data-vertical="^\n\n"></section>
62 At the end of your page you need to initialize reveal by running the following code. Note that all config values are optional and will default as specified below.
67 // Display controls in the bottom right corner
70 // Display a presentation progress bar
73 // Push each slide change to the browser history
76 // Enable keyboard shortcuts for navigation
79 // Enable the slide overview mode
82 // Vertical centering of slides
85 // Loop the presentation
88 // Change the presentation direction to be RTL
91 // Number of milliseconds between automatically proceeding to the
92 // next slide, disabled when set to 0, this value can be overwritten
93 // by using a data-autoslide attribute on your slides
96 // Enable slide navigation via mouse wheel
99 // Apply a 3D roll to links on hover
103 transition: 'default', // default/cube/page/concave/zoom/linear/fade/none
106 transitionSpeed: 'default', // default/fast/slow
111 Note that the new default vertical centering option will break compatibility with slides that were using transitions with backgrounds (`cube` and `page`). To restore the previous behavior, set `center` to `false`.
114 The configuration can be updated after initialization using the ```configure``` method:
117 // Turn autoSlide off
118 Reveal.configure({ autoSlide: 0 });
120 // Start auto-sliding every 5s
121 Reveal.configure({ autoSlide: 5000 });
125 ### Presentation Size
127 All presentations have a normal size, that is the resolution at which they are authored. The framework will automatically scale presentations uniformly based on this size to ensure that everything fits on any given display or viewport.
129 See below for a list of configuration options related to sizing, including default values:
136 // The "normal" size of the presentation, aspect ratio will be preserved
137 // when the presentation is scaled to fit different resolutions. Can be
138 // specified using percentage units.
142 // Factor of the display size that should remain empty around the content
145 // Bounds for smallest/largest possible scale to apply to content
155 Reveal.js doesn't _rely_ on any third party scripts to work but a few optional libraries are included by default. These libraries are loaded as dependencies in the order they appear, for example:
160 // Cross-browser shim that fully implements classList - https://github.com/eligrey/classList.js/
161 { src: 'lib/js/classList.js', condition: function() { return !document.body.classList; } },
163 // Interpret Markdown in <section> elements
164 { src: 'plugin/markdown/showdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
165 { src: 'plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
167 // Syntax highlight for <code> elements
168 { src: 'plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
170 // Zoom in and out with Alt+click
171 { src: 'plugin/zoom-js/zoom.js', async: true, condition: function() { return !!document.body.classList; } },
174 { src: 'plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } },
176 // Remote control your reveal.js presentation using a touch device
177 { src: 'plugin/remotes/remotes.js', async: true, condition: function() { return !!document.body.classList; } }
182 You can add your own extensions using the same syntax. The following properties are available for each dependency object:
183 - **src**: Path to the script to load
184 - **async**: [optional] Flags if the script should load after reveal.js has started, defaults to false
185 - **callback**: [optional] Function to execute when the script has loaded
186 - **condition**: [optional] Function which must return true for the script to be loaded
191 The ``Reveal`` class provides a minimal JavaScript API for controlling navigation and reading state:
195 Reveal.slide( indexh, indexv, indexf );
202 Reveal.prevFragment();
203 Reveal.nextFragment();
204 Reveal.toggleOverview();
206 // Retrieves the previous and current slide elements
207 Reveal.getPreviousSlide();
208 Reveal.getCurrentSlide();
210 Reveal.getIndices(); // { h: 0, v: 0 } }
215 If you set ``data-state="somestate"`` on a slide ``<section>``, "somestate" will be applied as a class on the document element when that slide is opened. This allows you to apply broad style changes to the page based on the active slide.
217 Furthermore you can also listen to these changes in state via JavaScript:
220 Reveal.addEventListener( 'somestate', function() {
221 // TODO: Sprinkle magic
227 The 'ready' event is fired when reveal.js has loaded all (synchronous) dependencies and is ready to start navigating.
230 Reveal.addEventListener( 'ready', function( event ) {
231 // event.currentSlide, event.indexh, event.indexv
235 ### Slide change event
237 An 'slidechanged' event is fired each time the slide is changed (regardless of state). The event object holds the index values of the current slide as well as a reference to the previous and current slide HTML nodes.
239 Some libraries, like MathJax (see [#226](https://github.com/hakimel/reveal.js/issues/226#issuecomment-10261609)), get confused by the transforms and display states of slides. Often times, this can be fixed by calling their update or render function from this callback.
242 Reveal.addEventListener( 'slidechanged', function( event ) {
243 // event.previousSlide, event.currentSlide, event.indexh, event.indexv
249 It's easy to link between slides. The first example below targets the index of another slide whereas the second targets a slide with an ID attribute (```<section id="some-slide">```):
252 <a href="#/2/2">Link</a>
253 <a href="#/some-slide">Link</a>
256 You can also add relative navigation links, similar to the built in reveal.js controls, by appending one of the following classes on any element. Note that each element is automatically given an ```enabled``` class when it's a valid navigation route based on the current slide.
259 <a href="#" class="navigate-left">
260 <a href="#" class="navigate-right">
261 <a href="#" class="navigate-up">
262 <a href="#" class="navigate-down">
263 <a href="#" class="navigate-prev"> <!-- Previous vertical or horizontal slide -->
264 <a href="#" class="navigate-next"> <!-- Next vertical or horizontal slide -->
267 ### Alternating transitions
268 The global presentation transition is set using the ```transition``` config value. You can override the global transition for a specific slide by using the ```data-transition``` attribute:
271 <section data-transition="zoom">
272 <h2>This slide will override the presentation transition and zoom!</h2>
275 <section data-transition-speed="fast">
276 <h2>Choose from three transition speeds: default, fast or slow!</h2>
280 Note that this does not work with the page and cube transitions.
284 Fragments are used to highlight individual elements on a slide. Every elmement with the class ```fragment``` will be stepped through before moving on to the next slide. Here's an example: http://lab.hakim.se/reveal-js/#/16
286 The default fragment style is to start out invisible and fade in. This style can be changed by appending a different class to the fragment:
290 <p class="fragment grow">grow</p>
291 <p class="fragment shrink">shrink</p>
292 <p class="fragment roll-in">roll-in</p>
293 <p class="fragment fade-out">fade-out</p>
294 <p class="fragment highlight-red">highlight-red</p>
295 <p class="fragment highlight-green">highlight-green</p>
296 <p class="fragment highlight-blue">highlight-blue</p>
300 Multiple fragments can be applied to the same element sequentially by wrapping it, this will fade in the text on the first step and fade it back out on the second.
304 <span class="fragment fade-in">
305 <span class="fragment fade-out">I'll fade in, then out</span>
310 The display order of fragments can be controlled using the ```data-fragment-index``` attribute.
314 <p class="fragment" data-fragment-index="3">Appears last</p>
315 <p class="fragment" data-fragment-index="1">Appears first</p>
316 <p class="fragment" data-fragment-index="2">Appears second</p>
322 When a slide fragment is either shown or hidden reveal.js will dispatch an event.
325 Reveal.addEventListener( 'fragmentshown', function( event ) {
326 // event.fragment = the fragment DOM element
328 Reveal.addEventListener( 'fragmenthidden', function( event ) {
329 // event.fragment = the fragment DOM element
333 ### Code syntax highlighting
335 By default, Reveal is configured with [highlight.js](http://softwaremaniacs.org/soft/highlight/en/) for code syntax highlighting. Below is an example with clojure code that will be syntax highlighted:
344 (lazy-cons (+ a b) (rfib b (+ a b)))) 0 1)))
352 Press "Esc" key to toggle the overview mode on and off. While you're in this mode, you can still navigate between slides,
353 as if you were at 1,000 feet above your presentation. The overview mode comes with a few API hooks:
356 Reveal.addEventListener( 'overviewshown', function( event ) { /* ... */ } );
357 Reveal.addEventListener( 'overviewhidden', function( event ) { /* ... */ } );
359 // Toggle the overview mode programmatically
360 Reveal.toggleOverview();
364 Just press »F« on your keyboard to show your presentation in fullscreen mode. Press the »ESC« key to exit fullscreen mode.
369 Presentations can be exported to PDF via a special print stylesheet. This feature requires that you use [Google Chrome](http://google.com/chrome).
370 Here's an example of an exported presentation that's been uploaded to SlideShare: http://www.slideshare.net/hakimel/revealjs-13872948.
372 1. Open your presentation with [css/print/pdf.css](https://github.com/hakimel/reveal.js/blob/master/css/print/pdf.css) included on the page. The default index HTML lets you add *print-pdf* anywhere in the query to include the stylesheet, for example: [lab.hakim.se/reveal-js?print-pdf](http://lab.hakim.se/reveal-js?print-pdf).
373 2. Open the in-browser print dialog (CMD+P).
374 3. Change the **Destination** setting to **Save as PDF**.
375 4. Change the **Layout** to **Landscape**.
376 5. Change the **Margins** to **None**.
379 ![Chrome Print Settings](https://s3.amazonaws.com/hakim-static/reveal-js/pdf-print-settings.png)
384 reveal.js comes with a speaker notes plugin which can be used to present per-slide notes in a separate browser window. The notes window also gives you a preview of the next upcoming slide so it may be helpful even if you haven't written any notes. Append ```?notes``` to the presentation URL or press the 's' key on your keyboard to open the notes window.
386 By default notes are written using standard HTML, see below, but you can add a ```data-markdown``` attribute to the ```<aside>``` to write them using Markdown.
392 <aside class="notes">
393 Oh hey, these are some notes. They'll be hidden in your presentation, but you can see them if you open the speaker notes window (hit 's' on your keyboard).
398 ## Server Side Speaker Notes
400 In some cases it can be desirable to run notes on a separate device from the one you're presenting on. The Node.js-based notes plugin lets you do this using the same note definitions as its client side counterpart. Include the required scripts by adding the following dependencies:
407 { src: 'socket.io/socket.io.js', async: true },
408 { src: 'plugin/notes-server/client.js', async: true }
415 1. Install [Node.js](http://nodejs.org/)
416 2. Run ```npm install```
417 3. Run ```node plugin/notes-server```
422 The multiplex plugin allows your audience to view the slides of the presentation you are controlling on their own phone, tablet or laptop. As the master presentation navigates the slides, all client presentations will update in real time. See a demo at [http://revealjs.jit.su/](http://revealjs.jit.su).
424 The multiplex plugin needs the following 3 things to operate:
426 1. Master presentation that has control
427 2. Client presentations that follow the master
428 3. Socket.io server to broadcast events from the master to the clients
432 #### Master presentation
433 Served from a static file server accessible (preferably) only to the presenter. This need only be on your (the presenter's) computer. (It's safer to run the master presentation from your own computer, so if the venue's Internet goes down it doesn't stop the show.) An example would be to execute the following commands in the directory of your master presentation:
435 1. ```npm install node-static```
438 If you want to use the speaker notes plugin with you master presentation then make sure you have the speaker notes plugin configured correctly along with the configuration shown below, then execute ```node plugin/notes-server``` in the directory of your master presentation. The configuration below will cause it to connect to the socket.io server as a master, as well as launch your speaker-notes/static-file server.
440 You can then access your master presentation at ```http://localhost:1947```
442 Example configuration:
448 // Example values. Generate your own.
449 secret: '13652805320794272084', // Obtained from the socket.io server. Gives this (the master) control of the presentation
450 id: '1ea875674b17ca76', // Obtained from socket.io server
451 url: 'revealjs.jit.su:80' // Location of socket.io server
454 // Optional libraries used to extend on reveal.js
457 { src: '//cdnjs.cloudflare.com/ajax/libs/socket.io/0.9.10/socket.io.min.js', async: true },
458 { src: 'plugin/multiplex/master.js', async: true },
460 // and if you want speaker notes
461 { src: 'plugin/notes-server/client.js', async: true }
466 #### Client presentation
467 Served from a publicly accessible static file server. Examples include: GitHub Pages, Amazon S3, Dreamhost, Akamai, etc. The more reliable, the better. Your audience can then access the client presentation via ```http://example.com/path/to/presentation/client/index.html```, with the configuration below causing them to connect to the socket.io server as clients.
469 Example configuration:
475 // Example values. Generate your own.
476 secret: null, // null so the clients do not have control of the master presentation
477 id: '1ea875674b17ca76', // id, obtained from socket.io server
478 url: 'revealjs.jit.su:80' // Location of socket.io server
481 // Optional libraries used to extend on reveal.js
484 { src: '//cdnjs.cloudflare.com/ajax/libs/socket.io/0.9.10/socket.io.min.js', async: true },
485 { src: 'plugin/multiplex/client.js', async: true }
490 #### Socket.io server
491 Server that receives the slideChanged events from the master presentation and broadcasts them out to the connected client presentations. This needs to be publicly accessible. You can run your own socket.io server with the commands:
494 2. ```node plugin/multiplex```
496 Or you use the socket.io server at [http://revealjs.jit.su](http://revealjs.jit.su).
498 You'll need to generate a unique secret and token pair for your master and client presentations. To do so, visit ```http://example.com/token```, where ```http://example.com``` is the location of your socket.io server. Or if you're going to use the socket.io server at [http://revealjs.jit.su](http://revealjs.jit.su), visit [http://revealjs.jit.su/token](http://revealjs.jit.su/token).
500 You are very welcome to point your presentations at the Socket.io server running at [http://revealjs.jit.su](http://revealjs.jit.su), but availability and stability are not guaranteed. For anything mission critical I recommend you run your own server. It is simple to deploy to nodejitsu, heroku, your own environment, etc.
502 ##### socket.io server as file static server
504 The socket.io server can play the role of static file server for your client presentation, as in the example at [http://revealjs.jit.su](http://revealjs.jit.su). (Open [http://revealjs.jit.su](http://revealjs.jit.su) in two browsers. Navigate through the slides on one, and the other will update to match.)
506 Example configuration:
512 // Example values. Generate your own.
513 secret: null, // null so the clients do not have control of the master presentation
514 id: '1ea875674b17ca76', // id, obtained from socket.io server
515 url: 'example.com:80' // Location of your socket.io server
518 // Optional libraries used to extend on reveal.js
521 { src: '//cdnjs.cloudflare.com/ajax/libs/socket.io/0.9.10/socket.io.min.js', async: true },
522 { src: 'plugin/multiplex/client.js', async: true }
526 It can also play the role of static file server for your master presentation and client presentations at the same time (as long as you don't want to use speaker notes). (Open [http://revealjs.jit.su](http://revealjs.jit.su) in two browsers. Navigate through the slides on one, and the other will update to match. Navigate through the slides on the second, and the first will update to match.) This is probably not desirable, because you don't want your audience to mess with your slides while you're presenting. ;)
528 Example configuration:
534 // Example values. Generate your own.
535 secret: '13652805320794272084', // Obtained from the socket.io server. Gives this (the master) control of the presentation
536 id: '1ea875674b17ca76', // Obtained from socket.io server
537 url: 'example.com:80' // Location of your socket.io server
540 // Optional libraries used to extend on reveal.js
543 { src: '//cdnjs.cloudflare.com/ajax/libs/socket.io/0.9.10/socket.io.min.js', async: true },
544 { src: 'plugin/multiplex/master.js', async: true },
545 { src: 'plugin/multiplex/client.js', async: true }
552 The framework comes with a few different themes included:
554 - default: Gray background, white text, blue links
555 - beige: Beige background, dark text, brown links
556 - sky: Blue background, thin white text, blue links
557 - night: Black background, thick white text, orange links
558 - serif: Cappuccino background, gray text, brown links
559 - simple: White background, black text, blue links
561 Each theme is available as a separate stylesheet. To change theme you will need to replace **default** below with your desired theme name in index.html:
564 <link rel="stylesheet" href="css/theme/default.css" id="theme">
567 If you want to add a theme of your own see the instructions here: [/css/theme/README.md](https://github.com/hakimel/reveal.js/blob/master/css/theme/README.md).
570 ## Development Environment
572 reveal.js is built using the task-based command line build tool [grunt.js](http://gruntjs.com) ([installation instructions](http://gruntjs.com/getting-started#installing-the-cli)). With Node.js and grunt.js installed, you need to start by running ```npm install``` in the reveal.js root. When the dependencies have been installed you should run ```grunt watch``` to start monitoring files for changes.
574 If you want to customise reveal.js without running grunt.js you can alter the HTML to point to the uncompressed source files (css/reveal.css & js/reveal.js).
577 - **css/** Core styles without which the project does not function
578 - **js/** Like above but for JavaScript
579 - **plugin/** Components that have been developed as extensions to reveal.js
580 - **lib/** All other third party assets (JavaScript, CSS, fonts)
587 Copyright (C) 2013 Hakim El Hattab, http://hakim.se