Merge changes from topics 'fix_unix_rights_py', 'stop_creating_ODL_dir'
[functest.git] / docs / com / README.md
1 # reveal.js [![Build Status](https://travis-ci.org/hakimel/reveal.js.svg?branch=master)](https://travis-ci.org/hakimel/reveal.js)
2
3 A framework for easily creating beautiful presentations using HTML. [Check out the live demo](http://lab.hakim.se/reveal-js/).
4
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 modern browser but [fallbacks](https://github.com/hakimel/reveal.js/wiki/Browser-Support) are available to make sure your presentation can still be viewed elsewhere.
6
7
8 #### More reading:
9 - [Installation](#installation): Step-by-step instructions for getting reveal.js running on your computer.
10 - [Changelog](https://github.com/hakimel/reveal.js/releases): Up-to-date version history.
11 - [Examples](https://github.com/hakimel/reveal.js/wiki/Example-Presentations): Presentations created with reveal.js, add your own!
12 - [Browser Support](https://github.com/hakimel/reveal.js/wiki/Browser-Support): Explanation of browser support and fallbacks.
13 - [Plugins](https://github.com/hakimel/reveal.js/wiki/Plugins,-Tools-and-Hardware): A list of plugins that can be used to extend reveal.js.
14
15 ## Online Editor
16
17 Presentations are written using HTML or Markdown but there's also an online editor for those of you who prefer a graphical interface. Give it a try at [http://slides.com](http://slides.com).
18
19
20 ## Instructions
21
22 ### Markup
23
24 Markup hierarchy 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:
25
26 ```html
27 <div class="reveal">
28         <div class="slides">
29                 <section>Single Horizontal Slide</section>
30                 <section>
31                         <section>Vertical Slide 1</section>
32                         <section>Vertical Slide 2</section>
33                 </section>
34         </div>
35 </div>
36 ```
37
38 ### Markdown
39
40 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.
41
42 This is based on [data-markdown](https://gist.github.com/1343518) from [Paul Irish](https://github.com/paulirish) modified to use [marked](https://github.com/chjj/marked) to support [Github Flavoured Markdown](https://help.github.com/articles/github-flavored-markdown). Sensitive to indentation (avoid mixing tabs and spaces) and line breaks (avoid consecutive breaks).
43
44 ```html
45 <section data-markdown>
46         <script type="text/template">
47                 ## Page title
48
49                 A paragraph with some text and a [link](http://hakim.se).
50         </script>
51 </section>
52 ```
53
54 #### External Markdown
55
56 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. The ```data-charset``` attribute is optional and specifies which charset to use when loading the external file.
57
58 When used locally, this feature requires that reveal.js [runs from a local web server](#full-setup).
59
60 ```html
61 <section data-markdown="example.md"  
62          data-separator="^\n\n\n"  
63          data-separator-vertical="^\n\n"  
64          data-separator-notes="^Note:"  
65          data-charset="iso-8859-15">
66 </section>
67 ```
68
69 #### Element Attributes
70
71 Special syntax (in html comment) is available for adding attributes to Markdown elements. This is useful for fragments, amongst other things.
72
73 ```html
74 <section data-markdown>
75         <script type="text/template">
76                 - Item 1 <!-- .element: class="fragment" data-fragment-index="2" -->
77                 - Item 2 <!-- .element: class="fragment" data-fragment-index="1" -->
78         </script>
79 </section>
80 ```
81
82 #### Slide Attributes
83
84 Special syntax (in html comment) is available for adding attributes to the slide `<section>` elements generated by your Markdown.
85
86 ```html
87 <section data-markdown>
88         <script type="text/template">
89         <!-- .slide: data-background="#ff0000" -->
90                 Markdown content
91         </script>
92 </section>
93 ```
94
95
96 ### Configuration
97
98 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.
99
100 ```javascript
101 Reveal.initialize({
102
103         // Display controls in the bottom right corner
104         controls: true,
105
106         // Display a presentation progress bar
107         progress: true,
108
109         // Display the page number of the current slide
110         slideNumber: false,
111
112         // Push each slide change to the browser history
113         history: false,
114
115         // Enable keyboard shortcuts for navigation
116         keyboard: true,
117
118         // Enable the slide overview mode
119         overview: true,
120
121         // Vertical centering of slides
122         center: true,
123
124         // Enables touch navigation on devices with touch input
125         touch: true,
126
127         // Loop the presentation
128         loop: false,
129
130         // Change the presentation direction to be RTL
131         rtl: false,
132
133         // Turns fragments on and off globally
134         fragments: true,
135
136         // Flags if the presentation is running in an embedded mode,
137         // i.e. contained within a limited portion of the screen
138         embedded: false,
139
140         // Flags if we should show a help overlay when the questionmark
141         // key is pressed
142         help: true,
143
144         // Flags if speaker notes should be visible to all viewers
145         showNotes: false,
146
147         // Number of milliseconds between automatically proceeding to the
148         // next slide, disabled when set to 0, this value can be overwritten
149         // by using a data-autoslide attribute on your slides
150         autoSlide: 0,
151
152         // Stop auto-sliding after user input
153         autoSlideStoppable: true,
154
155         // Enable slide navigation via mouse wheel
156         mouseWheel: false,
157
158         // Hides the address bar on mobile devices
159         hideAddressBar: true,
160
161         // Opens links in an iframe preview overlay
162         previewLinks: false,
163
164         // Transition style
165         transition: 'default', // none/fade/slide/convex/concave/zoom
166
167         // Transition speed
168         transitionSpeed: 'default', // default/fast/slow
169
170         // Transition style for full page slide backgrounds
171         backgroundTransition: 'default', // none/fade/slide/convex/concave/zoom
172
173         // Number of slides away from the current that are visible
174         viewDistance: 3,
175
176         // Parallax background image
177         parallaxBackgroundImage: '', // e.g. "'https://s3.amazonaws.com/hakim-static/reveal-js/reveal-parallax-1.jpg'"
178
179         // Parallax background size
180         parallaxBackgroundSize: '', // CSS syntax, e.g. "2100px 900px"
181
182         // Amount to move parallax background (horizontal and vertical) on slide change
183         // Number, e.g. 100
184         parallaxBackgroundHorizontal: '',
185         parallaxBackgroundVertical: ''
186
187 });
188 ```
189
190
191 The configuration can be updated after initialization using the ```configure``` method:
192
193 ```javascript
194 // Turn autoSlide off
195 Reveal.configure({ autoSlide: 0 });
196
197 // Start auto-sliding every 5s
198 Reveal.configure({ autoSlide: 5000 });
199 ```
200
201
202 ### Dependencies
203
204 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:
205
206 ```javascript
207 Reveal.initialize({
208         dependencies: [
209                 // Cross-browser shim that fully implements classList - https://github.com/eligrey/classList.js/
210                 { src: 'lib/js/classList.js', condition: function() { return !document.body.classList; } },
211
212                 // Interpret Markdown in <section> elements
213                 { src: 'plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
214                 { src: 'plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
215
216                 // Syntax highlight for <code> elements
217                 { src: 'plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
218
219                 // Zoom in and out with Alt+click
220                 { src: 'plugin/zoom-js/zoom.js', async: true },
221
222                 // Speaker notes
223                 { src: 'plugin/notes/notes.js', async: true },
224
225                 // Remote control your reveal.js presentation using a touch device
226                 { src: 'plugin/remotes/remotes.js', async: true },
227
228                 // MathJax
229                 { src: 'plugin/math/math.js', async: true }
230         ]
231 });
232 ```
233
234 You can add your own extensions using the same syntax. The following properties are available for each dependency object:
235 - **src**: Path to the script to load
236 - **async**: [optional] Flags if the script should load after reveal.js has started, defaults to false
237 - **callback**: [optional] Function to execute when the script has loaded
238 - **condition**: [optional] Function which must return true for the script to be loaded
239
240
241 ### Ready Event
242
243 A 'ready' event is fired when reveal.js has loaded all non-async dependencies and is ready to start navigating. To check if reveal.js is already 'ready' you can call `Reveal.isReady()`.
244
245 ```javascript
246 Reveal.addEventListener( 'ready', function( event ) {
247         // event.currentSlide, event.indexh, event.indexv
248 } );
249 ```
250
251
252 ### Presentation Size
253
254 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.
255
256 See below for a list of configuration options related to sizing, including default values:
257
258 ```javascript
259 Reveal.initialize({
260
261         ...
262
263         // The "normal" size of the presentation, aspect ratio will be preserved
264         // when the presentation is scaled to fit different resolutions. Can be
265         // specified using percentage units.
266         width: 960,
267         height: 700,
268
269         // Factor of the display size that should remain empty around the content
270         margin: 0.1,
271
272         // Bounds for smallest/largest possible scale to apply to content
273         minScale: 0.2,
274         maxScale: 1.5
275
276 });
277 ```
278
279
280 ### Auto-sliding
281
282 Presentations can be configured to progress through slides automatically, without any user input. To enable this you will need to tell the framework how many milliseconds it should wait between slides:
283
284 ```javascript
285 // Slide every five seconds
286 Reveal.configure({
287   autoSlide: 5000
288 });
289 ```
290 When this is turned on a control element will appear that enables users to pause and resume auto-sliding. Alternatively, sliding can be paused or resumed by pressing Â»a« on the keyboard. Sliding is paused automatically as soon as the user starts navigating. You can disable these controls by specifying ```autoSlideStoppable: false``` in your reveal.js config.
291
292 You can also override the slide duration for individual slides and fragments by using the ```data-autoslide``` attribute:
293
294 ```html
295 <section data-autoslide="2000">
296         <p>After 2 seconds the first fragment will be shown.</p>
297         <p class="fragment" data-autoslide="10000">After 10 seconds the next fragment will be shown.</p>
298         <p class="fragment">Now, the fragment is displayed for 2 seconds before the next slide is shown.</p>
299 </section>
300 ```
301
302 Whenever the auto-slide mode is resumed or paused the ```autoslideresumed``` and ```autoslidepaused``` events are fired.
303
304
305 ### Keyboard Bindings
306
307 If you're unhappy with any of the default keyboard bindings you can override them using the ```keyboard``` config option:
308
309 ```javascript
310 Reveal.configure({
311   keyboard: {
312     13: 'next', // go to the next slide when the ENTER key is pressed
313     27: function() {}, // do something custom when ESC is pressed
314     32: null // don't do anything when SPACE is pressed (i.e. disable a reveal.js default binding)
315   }
316 });
317 ```
318
319 ### Touch Navigation
320
321 You can swipe to navigate through a presentation on any touch-enabled device. Horizontal swipes change between horizontal slides, vertical swipes change between vertical slides. If you wish to disable this you can set the `touch` config option to false when initializing reveal.js.
322
323 If there's some part of your content that needs to remain accessible to touch events you'll need to highlight this by adding a `data-prevent-swipe` attribute to the element. One common example where this is useful is elements that need to be scrolled.
324
325
326 ### Lazy Loading
327
328 When working on presentation with a lot of media or iframe content it's important to load lazily. Lazy loading means that reveal.js will only load content for the few slides nearest to the current slide. The number of slides that are preloaded is determined by the `viewDistance` configuration option.
329
330 To enable lazy loading all you need to do is change your "src" attributes to "data-src" as shown below. This is supported for image, video, audio and iframe elements. Lazy loaded iframes will also unload when the containing slide is no longer visible.
331
332 ```html
333 <section>
334   <img data-src="image.png">
335   <iframe data-src="http://hakim.se"></iframe>
336   <video>
337     <source data-src="video.webm" type="video/webm" />
338     <source data-src="video.mp4" type="video/mp4" />
339   </video>
340 </section>
341 ```
342
343
344 ### API
345
346 The ``Reveal`` object exposes a JavaScript API for controlling navigation and reading state:
347
348 ```javascript
349 // Navigation
350 Reveal.slide( indexh, indexv, indexf );
351 Reveal.left();
352 Reveal.right();
353 Reveal.up();
354 Reveal.down();
355 Reveal.prev();
356 Reveal.next();
357 Reveal.prevFragment();
358 Reveal.nextFragment();
359
360 // Toggle presentation states, optionally pass true/false to force on/off
361 Reveal.toggleOverview();
362 Reveal.togglePause();
363 Reveal.toggleAutoSlide();
364
365 // Change a config value at runtime
366 Reveal.configure({ controls: true });
367
368 // Returns the present configuration options
369 Reveal.getConfig();
370
371 // Fetch the current scale of the presentation
372 Reveal.getScale();
373
374 // Retrieves the previous and current slide elements
375 Reveal.getPreviousSlide();
376 Reveal.getCurrentSlide();
377
378 Reveal.getIndices(); // { h: 0, v: 0 } }
379 Reveal.getProgress(); // 0-1
380 Reveal.getTotalSlides();
381
382 // Returns the speaker notes for the current slide
383 Reveal.getSlideNotes();
384
385 // State checks
386 Reveal.isFirstSlide();
387 Reveal.isLastSlide();
388 Reveal.isOverview();
389 Reveal.isPaused();
390 Reveal.isAutoSliding();
391 ```
392
393 ### Slide Changed Event
394
395 A '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.
396
397 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.
398
399 ```javascript
400 Reveal.addEventListener( 'slidechanged', function( event ) {
401         // event.previousSlide, event.currentSlide, event.indexh, event.indexv
402 } );
403 ```
404
405 ### Presentation State
406
407 The presentation's current state can be fetched by using the `getState` method. A state object contains all of the information required to put the presentation back as it was when `getState` was first called. Sort of like a snapshot. It's a simple object that can easily be stringified and persisted or sent over the wire.
408
409 ```javascript
410 Reveal.slide( 1 );
411 // we're on slide 1
412
413 var state = Reveal.getState();
414
415 Reveal.slide( 3 );
416 // we're on slide 3
417
418 Reveal.setState( state );
419 // we're back on slide 1
420 ```
421
422 ### Slide States
423
424 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.
425
426 Furthermore you can also listen to these changes in state via JavaScript:
427
428 ```javascript
429 Reveal.addEventListener( 'somestate', function() {
430         // TODO: Sprinkle magic
431 }, false );
432 ```
433
434 ### Slide Backgrounds
435
436 Slides are contained within a limited portion of the screen by default to allow them to fit any display and scale uniformly. You can apply full page backgrounds outside of the slide area by adding a ```data-background``` attribute to your ```<section>``` elements. Four different types of backgrounds are supported: color, image, video and iframe. Below are a few examples.
437
438 ```html
439 <section data-background="#ff0000">
440         <h2>All CSS color formats are supported, like rgba() or hsl().</h2>
441 </section>
442 <section data-background="http://example.com/image.png">
443         <h2>This slide will have a full-size background image.</h2>
444 </section>
445 <section data-background="http://example.com/image.png" data-background-size="100px" data-background-repeat="repeat">
446         <h2>This background image will be sized to 100px and repeated.</h2>
447 </section>
448 <section data-background-video="https://s3.amazonaws.com/static.slid.es/site/homepage/v1/homepage-video-editor.mp4,https://s3.amazonaws.com/static.slid.es/site/homepage/v1/homepage-video-editor.webm" data-background-video-loop>
449         <h2>Video. Multiple sources can be defined using a comma separated list. Video will loop when the data-background-video-loop attribute is provided.</h2>
450 </section>
451 <section data-background-iframe="https://slides.com">
452         <h2>Embeds a web page as a background. Note that the page won't be interactive.</h2>
453 </section>
454 ```
455
456 Backgrounds transition using a fade animation by default. This can be changed to a linear sliding transition by passing ```backgroundTransition: 'slide'``` to the ```Reveal.initialize()``` call. Alternatively you can set ```data-background-transition``` on any section with a background to override that specific transition.
457
458
459 ### Parallax Background
460
461 If you want to use a parallax scrolling background, set the first two config properties below when initializing reveal.js (the other two are optional).
462
463 ```javascript
464 Reveal.initialize({
465
466         // Parallax background image
467         parallaxBackgroundImage: '', // e.g. "https://s3.amazonaws.com/hakim-static/reveal-js/reveal-parallax-1.jpg"
468
469         // Parallax background size
470         parallaxBackgroundSize: '', // CSS syntax, e.g. "2100px 900px" - currently only pixels are supported (don't use % or auto)
471
472         // Amount of pixels to move the parallax background per slide step,
473         // a value of 0 disables movement along the given axis
474         // These are optional, if they aren't specified they'll be calculated automatically
475         parallaxBackgroundHorizontal: 200,
476         parallaxBackgroundVertical: 50
477
478 });
479 ```
480
481 Make sure that the background size is much bigger than screen size to allow for some scrolling. [View example](http://lab.hakim.se/reveal-js/?parallaxBackgroundImage=https%3A%2F%2Fs3.amazonaws.com%2Fhakim-static%2Freveal-js%2Freveal-parallax-1.jpg&parallaxBackgroundSize=2100px%20900px).
482
483
484
485 ### Slide Transitions
486 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:
487
488 ```html
489 <section data-transition="zoom">
490         <h2>This slide will override the presentation transition and zoom!</h2>
491 </section>
492
493 <section data-transition-speed="fast">
494         <h2>Choose from three transition speeds: default, fast or slow!</h2>
495 </section>
496 ```
497
498 You can also use different in and out transitions for the same slide:
499
500 ```html
501 <section data-transition="slide">
502     The train goes on â€¦ 
503 </section>
504 <section data-transition="slide"> 
505     and on â€¦ 
506 </section>
507 <section data-transition="slide-in fade-out"> 
508     and stops.
509 </section>
510 <section data-transition="fade-in slide-out"> 
511     (Passengers entering and leaving)
512 </section>
513 <section data-transition="slide">
514     And it starts again.
515 </section>
516 ```
517
518
519 Note that this does not work with the page and cube transitions.
520
521
522 ### Internal links
523
524 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">```):
525
526 ```html
527 <a href="#/2/2">Link</a>
528 <a href="#/some-slide">Link</a>
529 ```
530
531 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.
532
533 ```html
534 <a href="#" class="navigate-left">
535 <a href="#" class="navigate-right">
536 <a href="#" class="navigate-up">
537 <a href="#" class="navigate-down">
538 <a href="#" class="navigate-prev"> <!-- Previous vertical or horizontal slide -->
539 <a href="#" class="navigate-next"> <!-- Next vertical or horizontal slide -->
540 ```
541
542
543 ### Fragments
544 Fragments are used to highlight individual elements on a slide. Every element 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/#/fragments
545
546 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:
547
548 ```html
549 <section>
550         <p class="fragment grow">grow</p>
551         <p class="fragment shrink">shrink</p>
552         <p class="fragment fade-out">fade-out</p>
553         <p class="fragment current-visible">visible only once</p>
554         <p class="fragment highlight-current-blue">blue only once</p>
555         <p class="fragment highlight-red">highlight-red</p>
556         <p class="fragment highlight-green">highlight-green</p>
557         <p class="fragment highlight-blue">highlight-blue</p>
558 </section>
559 ```
560
561 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.
562
563 ```html
564 <section>
565         <span class="fragment fade-in">
566                 <span class="fragment fade-out">I'll fade in, then out</span>
567         </span>
568 </section>
569 ```
570
571 The display order of fragments can be controlled using the ```data-fragment-index``` attribute.
572
573 ```html
574 <section>
575         <p class="fragment" data-fragment-index="3">Appears last</p>
576         <p class="fragment" data-fragment-index="1">Appears first</p>
577         <p class="fragment" data-fragment-index="2">Appears second</p>
578 </section>
579 ```
580
581 ### Fragment events
582
583 When a slide fragment is either shown or hidden reveal.js will dispatch an event.
584
585 Some libraries, like MathJax (see #505), get confused by the initially hidden fragment elements. Often times this can be fixed by calling their update or render function from this callback.
586
587 ```javascript
588 Reveal.addEventListener( 'fragmentshown', function( event ) {
589         // event.fragment = the fragment DOM element
590 } );
591 Reveal.addEventListener( 'fragmenthidden', function( event ) {
592         // event.fragment = the fragment DOM element
593 } );
594 ```
595
596 ### Code syntax highlighting
597
598 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. When the `data-trim` attribute is present surrounding whitespace is automatically removed.
599
600 ```html
601 <section>
602         <pre><code data-trim>
603 (def lazy-fib
604   (concat
605    [0 1]
606    ((fn rfib [a b]
607         (lazy-cons (+ a b) (rfib b (+ a b)))) 0 1)))
608         </code></pre>
609 </section>
610 ```
611
612 ### Slide number
613 If you would like to display the page number of the current slide you can do so using the ```slideNumber``` configuration value.
614
615 ```javascript
616 // Shows the slide number using default formatting
617 Reveal.configure({ slideNumber: true });
618
619 // Slide number formatting can be configured using these variables:
620 //  h: current slide's horizontal index
621 //  v: current slide's vertical index
622 //  c: current slide index (flattened)
623 //  t: total number of slides (flattened)
624 Reveal.configure({ slideNumber: 'c / t' });
625
626 ```
627
628
629 ### Overview mode
630
631 Press "Esc" or "o" keys to toggle the overview mode on and off. While you're in this mode, you can still navigate between slides,
632 as if you were at 1,000 feet above your presentation. The overview mode comes with a few API hooks:
633
634 ```javascript
635 Reveal.addEventListener( 'overviewshown', function( event ) { /* ... */ } );
636 Reveal.addEventListener( 'overviewhidden', function( event ) { /* ... */ } );
637
638 // Toggle the overview mode programmatically
639 Reveal.toggleOverview();
640 ```
641
642 ### Fullscreen mode
643 Just press Â»F« on your keyboard to show your presentation in fullscreen mode. Press the Â»ESC« key to exit fullscreen mode.
644
645
646 ### Embedded media
647 Embedded HTML5 `<video>`/`<audio>` and YouTube iframes are automatically paused when you navigate away from a slide. This can be disabled by decorating your element with a `data-ignore` attribute.
648
649 Add `data-autoplay` to your media element if you want it to automatically start playing when the slide is shown:
650
651 ```html
652 <video data-autoplay src="http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"></video>
653 ```
654
655 Additionally the framework automatically pushes two [post messages](https://developer.mozilla.org/en-US/docs/Web/API/Window.postMessage) to all iframes, ```slide:start``` when the slide containing the iframe is made visible and ```slide:stop``` when it is hidden.
656
657
658 ### Stretching elements
659 Sometimes it's desirable to have an element, like an image or video, stretch to consume as much space as possible within a given slide. This can be done by adding the ```.stretch``` class to an element as seen below:
660
661 ```html
662 <section>
663         <h2>This video will use up the remaining space on the slide</h2>
664     <video class="stretch" src="http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"></video>
665 </section>
666 ```
667
668 Limitations:
669 - Only direct descendants of a slide section can be stretched
670 - Only one descendant per slide section can be stretched
671
672
673 ### postMessage API
674 The framework has a built-in postMessage API that can be used when communicating with a presentation inside of another window. Here's an example showing how you'd make a reveal.js instance in the given window proceed to slide 2:
675
676 ```javascript
677 <window>.postMessage( JSON.stringify({ method: 'slide', args: [ 2 ] }), '*' );
678 ```
679
680 When reveal.js runs inside of an iframe it can optionally bubble all of its events to the parent. Bubbled events are stringified JSON with three fields: namespace, eventName and state. Here's how you subscribe to them from the parent window:
681
682 ```javascript
683 window.addEventListener( 'message', function( event ) {
684         var data = JSON.parse( event.data );
685         if( data.namespace === 'reveal' && data.eventName ='slidechanged' ) {
686                 // Slide changed, see data.state for slide number
687         }
688 } );
689 ```
690
691 This cross-window messaging can be toggled on or off using configuration flags.
692
693 ```javascript
694 Reveal.initialize({
695         ...,
696
697         // Exposes the reveal.js API through window.postMessage
698         postMessage: true,
699
700         // Dispatches all reveal.js events to the parent window through postMessage
701         postMessageEvents: false
702 });
703 ```
704
705
706 ## PDF Export
707
708 Presentations can be exported to PDF via a special print stylesheet. This feature requires that you use [Google Chrome](http://google.com/chrome) or [Chromium](https://www.chromium.org/Home).
709 Here's an example of an exported presentation that's been uploaded to SlideShare: http://www.slideshare.net/hakimel/revealjs-300.
710
711 1. Open your presentation with `print-pdf` included anywhere in the query string. This triggers the default index HTML to load the PDF print stylesheet ([css/print/pdf.css](https://github.com/hakimel/reveal.js/blob/master/css/print/pdf.css)). You can test this with [lab.hakim.se/reveal-js?print-pdf](http://lab.hakim.se/reveal-js?print-pdf).
712 2. Open the in-browser print dialog (CMD+P).
713 3. Change the **Destination** setting to **Save as PDF**.
714 4. Change the **Layout** to **Landscape**.
715 5. Change the **Margins** to **None**.
716 6. Click **Save**.
717
718 ![Chrome Print Settings](https://s3.amazonaws.com/hakim-static/reveal-js/pdf-print-settings.png)
719
720 Alternatively you can use the [decktape](https://github.com/astefanutti/decktape) project.
721
722 ## Theming
723
724 The framework comes with a few different themes included:
725
726 - black: Black background, white text, blue links (default theme)
727 - white: White background, black text, blue links
728 - league: Gray background, white text, blue links (default theme for reveal.js < 3.0.0)
729 - beige: Beige background, dark text, brown links
730 - sky: Blue background, thin dark text, blue links
731 - night: Black background, thick white text, orange links
732 - serif: Cappuccino background, gray text, brown links
733 - simple: White background, black text, blue links
734 - solarized: Cream-colored background, dark green text, blue links
735
736 Each theme is available as a separate stylesheet. To change theme you will need to replace **black** below with your desired theme name in index.html:
737
738 ```html
739 <link rel="stylesheet" href="css/theme/black.css" id="theme">
740 ```
741
742 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).
743
744
745 ## Speaker Notes
746
747 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. Press the 's' key on your keyboard to open the notes window.
748
749 Notes are defined by appending an ```<aside>``` element to a slide as seen below. You can add the ```data-markdown``` attribute to the aside element if you prefer writing notes using Markdown.
750
751 Alternatively you can add your notes in a `data-notes` attribute on the slide. Like `<section data-notes="Something important"></section>`.
752
753 When used locally, this feature requires that reveal.js [runs from a local web server](#full-setup).
754
755 ```html
756 <section>
757         <h2>Some Slide</h2>
758
759         <aside class="notes">
760                 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).
761         </aside>
762 </section>
763 ```
764
765 Notes are only visible to you in the speaker view. If you wish to share your notes with the audience initialize reveal.js with the `showNotes` config value set to `true`.
766
767 If you're using the external Markdown plugin, you can add notes with the help of a special delimiter:
768
769 ```html
770 <section data-markdown="example.md" data-separator="^\n\n\n" data-separator-vertical="^\n\n" data-separator-notes="^Note:"></section>
771
772 # Title
773 ## Sub-title
774
775 Here is some content...
776
777 Note:
778 This will only display in the notes window.
779 ```
780
781 ## Server Side Speaker Notes
782
783 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:
784
785 ```javascript
786 Reveal.initialize({
787         ...
788
789         dependencies: [
790                 { src: 'socket.io/socket.io.js', async: true },
791                 { src: 'plugin/notes-server/client.js', async: true }
792         ]
793 });
794 ```
795
796 Then:
797
798 1. Install [Node.js](http://nodejs.org/)
799 2. Run ```npm install```
800 3. Run ```node plugin/notes-server```
801
802
803 ## Multiplexing
804
805 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-51546.onmodulus.net/](http://revealjs-51546.onmodulus.net/).
806
807 The multiplex plugin needs the following 3 things to operate:
808
809 1. Master presentation that has control
810 2. Client presentations that follow the master
811 3. Socket.io server to broadcast events from the master to the clients
812
813 More details:
814
815 #### Master presentation
816 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: 
817
818 1. ```npm install node-static```
819 2. ```static```
820
821 If you want to use the speaker notes plugin with your 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.
822
823 You can then access your master presentation at ```http://localhost:1947```
824
825 Example configuration:
826 ```javascript
827 Reveal.initialize({
828         // other options...
829
830         multiplex: {
831                 // Example values. To generate your own, see the socket.io server instructions.
832                 secret: '13652805320794272084', // Obtained from the socket.io server. Gives this (the master) control of the presentation
833                 id: '1ea875674b17ca76', // Obtained from socket.io server
834                 url: 'revealjs-51546.onmodulus.net:80' // Location of socket.io server
835         },
836
837         // Don't forget to add the dependencies
838         dependencies: [
839                 { src: '//cdn.socket.io/socket.io-1.3.5.js', async: true },
840                 { src: 'plugin/multiplex/master.js', async: true },
841
842                 // and if you want speaker notes
843                 { src: 'plugin/notes-server/client.js', async: true }
844
845                 // other dependencies...
846         ]
847 });
848 ```
849
850 #### Client presentation
851 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.
852
853 Example configuration:
854 ```javascript
855 Reveal.initialize({
856         // other options...
857
858         multiplex: {
859                 // Example values. To generate your own, see the socket.io server instructions.
860                 secret: null, // null so the clients do not have control of the master presentation
861                 id: '1ea875674b17ca76', // id, obtained from socket.io server
862                 url: 'revealjs-51546.onmodulus.net:80' // Location of socket.io server
863         },
864
865         // Don't forget to add the dependencies
866         dependencies: [
867                 { src: '//cdn.socket.io/socket.io-1.3.5.js', async: true },
868                 { src: 'plugin/multiplex/client.js', async: true }
869
870                 // other dependencies...
871         ]
872 });
873 ```
874
875 #### Socket.io server
876 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:
877
878 1. ```npm install```
879 2. ```node plugin/multiplex```
880
881 Or you use the socket.io server at [http://revealjs-51546.onmodulus.net/](http://revealjs-51546.onmodulus.net/).
882
883 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-51546.onmodulus.net/](http://revealjs-51546.onmodulus.net/), visit [http://revealjs-51546.onmodulus.net/token](http://revealjs-51546.onmodulus.net/token).
884
885 You are very welcome to point your presentations at the Socket.io server running at [http://revealjs-51546.onmodulus.net/](http://revealjs-51546.onmodulus.net/), 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.
886
887 ##### socket.io server as file static server
888
889 The socket.io server can play the role of static file server for your client presentation, as in the example at [http://revealjs-51546.onmodulus.net/](http://revealjs-51546.onmodulus.net/). (Open [http://revealjs-51546.onmodulus.net/](http://revealjs-51546.onmodulus.net/) in two browsers. Navigate through the slides on one, and the other will update to match.)
890
891 Example configuration:
892 ```javascript
893 Reveal.initialize({
894         // other options...
895
896         multiplex: {
897                 // Example values. To generate your own, see the socket.io server instructions.
898                 secret: null, // null so the clients do not have control of the master presentation
899                 id: '1ea875674b17ca76', // id, obtained from socket.io server
900                 url: 'example.com:80' // Location of your socket.io server
901         },
902
903         // Don't forget to add the dependencies
904         dependencies: [
905                 { src: '//cdn.socket.io/socket.io-1.3.5.js', async: true },
906                 { src: 'plugin/multiplex/client.js', async: true }
907
908                 // other dependencies...
909         ]
910 ```
911
912 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-51546.onmodulus.net/](http://revealjs-51546.onmodulus.net/) 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. ;)
913
914 Example configuration:
915 ```javascript
916 Reveal.initialize({
917         // other options...
918
919         multiplex: {
920                 // Example values. To generate your own, see the socket.io server instructions.
921                 secret: '13652805320794272084', // Obtained from the socket.io server. Gives this (the master) control of the presentation
922                 id: '1ea875674b17ca76', // Obtained from socket.io server
923                 url: 'example.com:80' // Location of your socket.io server
924         },
925
926         // Don't forget to add the dependencies
927         dependencies: [
928                 { src: '//cdn.socket.io/socket.io-1.3.5.js', async: true },
929                 { src: 'plugin/multiplex/master.js', async: true },
930                 { src: 'plugin/multiplex/client.js', async: true }
931
932                 // other dependencies...
933         ]
934 });
935 ```
936
937 ## MathJax
938
939 If you want to display math equations in your presentation you can easily do so by including this plugin. The plugin is a very thin wrapper around the [MathJax](http://www.mathjax.org/) library. To use it you'll need to include it as a reveal.js dependency, [find our more about dependencies here](#dependencies).
940
941 The plugin defaults to using [LaTeX](http://en.wikipedia.org/wiki/LaTeX) but that can be adjusted through the ```math``` configuration object. Note that MathJax is loaded from a remote server. If you want to use it offline you'll need to download a copy of the library and adjust the ```mathjax``` configuration value. 
942
943 Below is an example of how the plugin can be configured. If you don't intend to change these values you do not need to include the ```math``` config object at all.
944
945 ```js
946 Reveal.initialize({
947
948         // other options ...
949
950         math: {
951                 mathjax: 'https://cdn.mathjax.org/mathjax/latest/MathJax.js',
952                 config: 'TeX-AMS_HTML-full'  // See http://docs.mathjax.org/en/latest/config-files.html
953         },
954         
955         dependencies: [
956                 { src: 'plugin/math/math.js', async: true }
957         ]
958
959 });
960 ```
961
962 Read MathJax's documentation if you need [HTTPS delivery](http://docs.mathjax.org/en/latest/start.html#secure-access-to-the-cdn) or serving of [specific versions](http://docs.mathjax.org/en/latest/configuration.html#loading-mathjax-from-the-cdn) for stability.
963
964
965 ## Installation
966
967 The **basic setup** is for authoring presentations only. The **full setup** gives you access to all reveal.js features and plugins such as speaker notes as well as the development tasks needed to make changes to the source.
968
969 ### Basic setup
970
971 The core of reveal.js is very easy to install. You'll simply need to download a copy of this repository and open the index.html file directly in your browser.
972
973 1. Download the latest version of reveal.js from <https://github.com/hakimel/reveal.js/releases>
974
975 2. Unzip and replace the example contents in index.html with your own
976
977 3. Open index.html in a browser to view it
978
979
980 ### Full setup
981
982 Some reveal.js features, like external Markdown and speaker notes, require that presentations run from a local web server. The following instructions will set up such a server as well as all of the development tasks needed to make edits to the reveal.js source code.
983
984 1. Install [Node.js](http://nodejs.org/)
985
986 2. Install [Grunt](http://gruntjs.com/getting-started#installing-the-cli)
987
988 4. Clone the reveal.js repository
989    ```sh
990    $ git clone https://github.com/hakimel/reveal.js.git
991    ```
992
993 5. Navigate to the reveal.js folder
994    ```sh
995    $ cd reveal.js
996    ```
997
998 6. Install dependencies
999    ```sh
1000    $ npm install
1001    ```
1002
1003 7. Serve the presentation and monitor source files for changes
1004    ```sh
1005    $ grunt serve
1006    ```
1007
1008 8. Open <http://localhost:8000> to view your presentation
1009
1010    You can change the port by using `grunt serve --port 8001`.
1011
1012
1013 ### Folder Structure
1014 - **css/** Core styles without which the project does not function
1015 - **js/** Like above but for JavaScript
1016 - **plugin/** Components that have been developed as extensions to reveal.js
1017 - **lib/** All other third party assets (JavaScript, CSS, fonts)
1018
1019
1020 ## License
1021
1022 MIT licensed
1023
1024 Copyright (C) 2015 Hakim El Hattab, http://hakim.se