PageRenderTime 1417ms CodeModel.GetById 115ms RepoModel.GetById 20ms app.codeStats 0ms

/slides/lib/reveal.js/README.md

https://gitlab.com/msloco/gitforteams
Markdown | 933 lines | 646 code | 287 blank | 0 comment | 0 complexity | 2dc91e96185f200485993e0c62a6be82 MD5 | raw file
Possible License(s): MPL-2.0-no-copyleft-exception
  1. # reveal.js [![Build Status](https://travis-ci.org/hakimel/reveal.js.png?branch=master)](https://travis-ci.org/hakimel/reveal.js)
  2. A framework for easily creating beautiful presentations using HTML. [Check out the live demo](http://lab.hakim.se/reveal-js/).
  3. 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.
  4. #### More reading:
  5. - [Installation](#installation): Step-by-step instructions for getting reveal.js running on your computer.
  6. - [Changelog](https://github.com/hakimel/reveal.js/releases): Up-to-date version history.
  7. - [Examples](https://github.com/hakimel/reveal.js/wiki/Example-Presentations): Presentations created with reveal.js, add your own!
  8. - [Browser Support](https://github.com/hakimel/reveal.js/wiki/Browser-Support): Explanation of browser support and fallbacks.
  9. ## Online Editor
  10. 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://slid.es](http://slid.es).
  11. ## Instructions
  12. ### Markup
  13. 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:
  14. ```html
  15. <div class="reveal">
  16. <div class="slides">
  17. <section>Single Horizontal Slide</section>
  18. <section>
  19. <section>Vertical Slide 1</section>
  20. <section>Vertical Slide 2</section>
  21. </section>
  22. </div>
  23. </div>
  24. ```
  25. ### Markdown
  26. 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.
  27. 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).
  28. ```html
  29. <section data-markdown>
  30. <script type="text/template">
  31. ## Page title
  32. A paragraph with some text and a [link](http://hakim.se).
  33. </script>
  34. </section>
  35. ```
  36. #### External Markdown
  37. 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.
  38. When used locally, this feature requires that reveal.js [runs from a local web server](#full-setup).
  39. ```html
  40. <section data-markdown="example.md"
  41. data-separator="^\n\n\n"
  42. data-vertical="^\n\n"
  43. data-notes="^Note:"
  44. data-charset="iso-8859-15">
  45. </section>
  46. ```
  47. #### Element Attributes
  48. Special syntax (in html comment) is available for adding attributes to Markdown elements. This is useful for fragments, amongst other things.
  49. ```html
  50. <section data-markdown>
  51. <script type="text/template">
  52. - Item 1 <!-- .element: class="fragment" data-fragment-index="2" -->
  53. - Item 2 <!-- .element: class="fragment" data-fragment-index="1" -->
  54. </script>
  55. </section>
  56. ```
  57. #### Slide Attributes
  58. Special syntax (in html comment) is available for adding attributes to the slide `<section>` elements generated by your Markdown.
  59. ```html
  60. <section data-markdown>
  61. <script type="text/template">
  62. <!-- .slide: data-background="#ff0000" -->
  63. Markdown content
  64. </script>
  65. </section>
  66. ```
  67. ### Configuration
  68. 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.
  69. ```javascript
  70. Reveal.initialize({
  71. // Display controls in the bottom right corner
  72. controls: true,
  73. // Display a presentation progress bar
  74. progress: true,
  75. // Display the page number of the current slide
  76. slideNumber: false,
  77. // Push each slide change to the browser history
  78. history: false,
  79. // Enable keyboard shortcuts for navigation
  80. keyboard: true,
  81. // Enable the slide overview mode
  82. overview: true,
  83. // Vertical centering of slides
  84. center: true,
  85. // Enables touch navigation on devices with touch input
  86. touch: true,
  87. // Loop the presentation
  88. loop: false,
  89. // Change the presentation direction to be RTL
  90. rtl: false,
  91. // Turns fragments on and off globally
  92. fragments: true,
  93. // Flags if the presentation is running in an embedded mode,
  94. // i.e. contained within a limited portion of the screen
  95. embedded: false,
  96. // Number of milliseconds between automatically proceeding to the
  97. // next slide, disabled when set to 0, this value can be overwritten
  98. // by using a data-autoslide attribute on your slides
  99. autoSlide: 0,
  100. // Stop auto-sliding after user input
  101. autoSlideStoppable: true,
  102. // Enable slide navigation via mouse wheel
  103. mouseWheel: false,
  104. // Hides the address bar on mobile devices
  105. hideAddressBar: true,
  106. // Opens links in an iframe preview overlay
  107. previewLinks: false,
  108. // Transition style
  109. transition: 'default', // default/cube/page/concave/zoom/linear/fade/none
  110. // Transition speed
  111. transitionSpeed: 'default', // default/fast/slow
  112. // Transition style for full page slide backgrounds
  113. backgroundTransition: 'default', // default/none/slide/concave/convex/zoom
  114. // Number of slides away from the current that are visible
  115. viewDistance: 3,
  116. // Parallax background image
  117. parallaxBackgroundImage: '', // e.g. "'https://s3.amazonaws.com/hakim-static/reveal-js/reveal-parallax-1.jpg'"
  118. // Parallax background size
  119. parallaxBackgroundSize: '' // CSS syntax, e.g. "2100px 900px"
  120. });
  121. ```
  122. 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`.
  123. The configuration can be updated after initialization using the ```configure``` method:
  124. ```javascript
  125. // Turn autoSlide off
  126. Reveal.configure({ autoSlide: 0 });
  127. // Start auto-sliding every 5s
  128. Reveal.configure({ autoSlide: 5000 });
  129. ```
  130. ### Dependencies
  131. 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:
  132. ```javascript
  133. Reveal.initialize({
  134. dependencies: [
  135. // Cross-browser shim that fully implements classList - https://github.com/eligrey/classList.js/
  136. { src: 'lib/js/classList.js', condition: function() { return !document.body.classList; } },
  137. // Interpret Markdown in <section> elements
  138. { src: 'plugin/markdown/marked.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
  139. { src: 'plugin/markdown/markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
  140. // Syntax highlight for <code> elements
  141. { src: 'plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
  142. // Zoom in and out with Alt+click
  143. { src: 'plugin/zoom-js/zoom.js', async: true, condition: function() { return !!document.body.classList; } },
  144. // Speaker notes
  145. { src: 'plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } },
  146. // Remote control your reveal.js presentation using a touch device
  147. { src: 'plugin/remotes/remotes.js', async: true, condition: function() { return !!document.body.classList; } },
  148. // MathJax
  149. { src: 'plugin/math/math.js', async: true }
  150. ]
  151. });
  152. ```
  153. You can add your own extensions using the same syntax. The following properties are available for each dependency object:
  154. - **src**: Path to the script to load
  155. - **async**: [optional] Flags if the script should load after reveal.js has started, defaults to false
  156. - **callback**: [optional] Function to execute when the script has loaded
  157. - **condition**: [optional] Function which must return true for the script to be loaded
  158. ### Presentation Size
  159. 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.
  160. See below for a list of configuration options related to sizing, including default values:
  161. ```javascript
  162. Reveal.initialize({
  163. ...
  164. // The "normal" size of the presentation, aspect ratio will be preserved
  165. // when the presentation is scaled to fit different resolutions. Can be
  166. // specified using percentage units.
  167. width: 960,
  168. height: 700,
  169. // Factor of the display size that should remain empty around the content
  170. margin: 0.1,
  171. // Bounds for smallest/largest possible scale to apply to content
  172. minScale: 0.2,
  173. maxScale: 1.0
  174. });
  175. ```
  176. ### Auto-sliding
  177. Presentations can be configure 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:
  178. ```javascript
  179. // Slide every five seconds
  180. Reveal.configure({
  181. autoSlide: 5000
  182. });
  183. ```
  184. When this is turned on a control element will appear that enables users to pause and resume auto-sliding. Sliding is also paused automatically as soon as the user starts navigating. You can disable these controls by specifying ```autoSlideStoppable: false``` in your reveal.js config.
  185. You can also override the slide duration for individual slides by using the ```data-autoslide``` attribute on individual sections:
  186. ```html
  187. <section data-autoslide="10000">This will remain on screen for 10 seconds</section>
  188. ```
  189. ### Keyboard Bindings
  190. If you're unhappy with any of the default keyboard bindings you can override them using the ```keyboard``` config option:
  191. ```javascript
  192. Reveal.configure({
  193. keyboard: {
  194. 13: 'next', // go to the next slide when the ENTER key is pressed
  195. 27: function() {}, // do something custom when ESC is pressed
  196. 32: null // don't do anything when SPACE is pressed (i.e. disable a reveal.js default binding)
  197. }
  198. });
  199. ```
  200. ### API
  201. The ``Reveal`` class provides a JavaScript API for controlling navigation and reading state:
  202. ```javascript
  203. // Navigation
  204. Reveal.slide( indexh, indexv, indexf );
  205. Reveal.left();
  206. Reveal.right();
  207. Reveal.up();
  208. Reveal.down();
  209. Reveal.prev();
  210. Reveal.next();
  211. Reveal.prevFragment();
  212. Reveal.nextFragment();
  213. Reveal.toggleOverview();
  214. Reveal.togglePause();
  215. // Retrieves the previous and current slide elements
  216. Reveal.getPreviousSlide();
  217. Reveal.getCurrentSlide();
  218. Reveal.getIndices(); // { h: 0, v: 0 } }
  219. // State checks
  220. Reveal.isFirstSlide();
  221. Reveal.isLastSlide();
  222. Reveal.isOverview();
  223. Reveal.isPaused();
  224. ```
  225. ### Ready Event
  226. The 'ready' event is fired when reveal.js has loaded all (synchronous) dependencies and is ready to start navigating.
  227. ```javascript
  228. Reveal.addEventListener( 'ready', function( event ) {
  229. // event.currentSlide, event.indexh, event.indexv
  230. } );
  231. ```
  232. ### Slide Changed Event
  233. 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.
  234. 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.
  235. ```javascript
  236. Reveal.addEventListener( 'slidechanged', function( event ) {
  237. // event.previousSlide, event.currentSlide, event.indexh, event.indexv
  238. } );
  239. ```
  240. ### States
  241. 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.
  242. Furthermore you can also listen to these changes in state via JavaScript:
  243. ```javascript
  244. Reveal.addEventListener( 'somestate', function() {
  245. // TODO: Sprinkle magic
  246. }, false );
  247. ```
  248. ### Slide Backgrounds
  249. 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 background colors or images by applying a ```data-background``` attribute to your ```<section>``` elements. Below are a few examples.
  250. ```html
  251. <section data-background="#ff0000">
  252. <h2>All CSS color formats are supported, like rgba() or hsl().</h2>
  253. </section>
  254. <section data-background="http://example.com/image.png">
  255. <h2>This slide will have a full-size background image.</h2>
  256. </section>
  257. <section data-background="http://example.com/image.png" data-background-size="100px" data-background-repeat="repeat">
  258. <h2>This background image will be sized to 100px and repeated.</h2>
  259. </section>
  260. ```
  261. 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.
  262. ### Parallax Background
  263. If you want to use a parallax scrolling background, set the two following config properties when initializing reveal.js (the third one is optional).
  264. ```javascript
  265. Reveal.initialize({
  266. // Parallax background image
  267. parallaxBackgroundImage: '', // e.g. "https://s3.amazonaws.com/hakim-static/reveal-js/reveal-parallax-1.jpg"
  268. // Parallax background size
  269. parallaxBackgroundSize: '', // CSS syntax, e.g. "2100px 900px" - currently only pixels are supported (don't use % or auto)
  270. // This slide transition gives best results:
  271. transition: linear
  272. });
  273. ```
  274. 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).
  275. ### Slide Transitions
  276. 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:
  277. ```html
  278. <section data-transition="zoom">
  279. <h2>This slide will override the presentation transition and zoom!</h2>
  280. </section>
  281. <section data-transition-speed="fast">
  282. <h2>Choose from three transition speeds: default, fast or slow!</h2>
  283. </section>
  284. ```
  285. Note that this does not work with the page and cube transitions.
  286. ### Internal links
  287. 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">```):
  288. ```html
  289. <a href="#/2/2">Link</a>
  290. <a href="#/some-slide">Link</a>
  291. ```
  292. 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.
  293. ```html
  294. <a href="#" class="navigate-left">
  295. <a href="#" class="navigate-right">
  296. <a href="#" class="navigate-up">
  297. <a href="#" class="navigate-down">
  298. <a href="#" class="navigate-prev"> <!-- Previous vertical or horizontal slide -->
  299. <a href="#" class="navigate-next"> <!-- Next vertical or horizontal slide -->
  300. ```
  301. ### Fragments
  302. 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
  303. 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:
  304. ```html
  305. <section>
  306. <p class="fragment grow">grow</p>
  307. <p class="fragment shrink">shrink</p>
  308. <p class="fragment roll-in">roll-in</p>
  309. <p class="fragment fade-out">fade-out</p>
  310. <p class="fragment current-visible">visible only once</p>
  311. <p class="fragment highlight-current-blue">blue only once</p>
  312. <p class="fragment highlight-red">highlight-red</p>
  313. <p class="fragment highlight-green">highlight-green</p>
  314. <p class="fragment highlight-blue">highlight-blue</p>
  315. </section>
  316. ```
  317. 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.
  318. ```html
  319. <section>
  320. <span class="fragment fade-in">
  321. <span class="fragment fade-out">I'll fade in, then out</span>
  322. </span>
  323. </section>
  324. ```
  325. The display order of fragments can be controlled using the ```data-fragment-index``` attribute.
  326. ```html
  327. <section>
  328. <p class="fragment" data-fragment-index="3">Appears last</p>
  329. <p class="fragment" data-fragment-index="1">Appears first</p>
  330. <p class="fragment" data-fragment-index="2">Appears second</p>
  331. </section>
  332. ```
  333. ### Fragment events
  334. When a slide fragment is either shown or hidden reveal.js will dispatch an event.
  335. 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.
  336. ```javascript
  337. Reveal.addEventListener( 'fragmentshown', function( event ) {
  338. // event.fragment = the fragment DOM element
  339. } );
  340. Reveal.addEventListener( 'fragmenthidden', function( event ) {
  341. // event.fragment = the fragment DOM element
  342. } );
  343. ```
  344. ### Code syntax highlighting
  345. 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.
  346. ```html
  347. <section>
  348. <pre><code data-trim>
  349. (def lazy-fib
  350. (concat
  351. [0 1]
  352. ((fn rfib [a b]
  353. (lazy-cons (+ a b) (rfib b (+ a b)))) 0 1)))
  354. </code></pre>
  355. </section>
  356. ```
  357. ### Slide number
  358. If you would like to display the page number of the current slide you can do so using the ```slideNumber``` configuration value.
  359. ```javascript
  360. Reveal.configure({ slideNumber: true });
  361. ```
  362. ### Overview mode
  363. 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,
  364. as if you were at 1,000 feet above your presentation. The overview mode comes with a few API hooks:
  365. ```javascript
  366. Reveal.addEventListener( 'overviewshown', function( event ) { /* ... */ } );
  367. Reveal.addEventListener( 'overviewhidden', function( event ) { /* ... */ } );
  368. // Toggle the overview mode programmatically
  369. Reveal.toggleOverview();
  370. ```
  371. ### Fullscreen mode
  372. Just press »F« on your keyboard to show your presentation in fullscreen mode. Press the »ESC« key to exit fullscreen mode.
  373. ### Embedded media
  374. 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.
  375. Add `data-autoplay` to your media element if you want it to automatically start playing when the slide is shown:
  376. ```html
  377. <video data-autoplay src="http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"></video>
  378. ```
  379. 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.
  380. ### Stretching elements
  381. 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:
  382. ```html
  383. <section>
  384. <h2>This video will use up the remaining space on the slide</h2>
  385. <video class="stretch" src="http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"></video>
  386. </section>
  387. ```
  388. Limitations:
  389. - Only direct descendants of a slide section can be stretched
  390. - Only one descendant per slide section can be stretched
  391. ## PDF Export
  392. Presentations can be exported to PDF via a special print stylesheet. This feature requires that you use [Google Chrome](http://google.com/chrome).
  393. Here's an example of an exported presentation that's been uploaded to SlideShare: http://www.slideshare.net/hakimel/revealjs-13872948.
  394. 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).
  395. 2. Open the in-browser print dialog (CMD+P).
  396. 3. Change the **Destination** setting to **Save as PDF**.
  397. 4. Change the **Layout** to **Landscape**.
  398. 5. Change the **Margins** to **None**.
  399. 6. Click **Save**.
  400. ![Chrome Print Settings](https://s3.amazonaws.com/hakim-static/reveal-js/pdf-print-settings.png)
  401. ## Theming
  402. The framework comes with a few different themes included:
  403. - default: Gray background, white text, blue links
  404. - beige: Beige background, dark text, brown links
  405. - sky: Blue background, thin white text, blue links
  406. - night: Black background, thick white text, orange links
  407. - serif: Cappuccino background, gray text, brown links
  408. - simple: White background, black text, blue links
  409. - solarized: Cream-colored background, dark green text, blue links
  410. 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:
  411. ```html
  412. <link rel="stylesheet" href="css/theme/default.css" id="theme">
  413. ```
  414. 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).
  415. ## Speaker Notes
  416. 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.
  417. 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.
  418. When used locally, this feature requires that reveal.js [runs from a local web server](#full-setup).
  419. ```html
  420. <section>
  421. <h2>Some Slide</h2>
  422. <aside class="notes">
  423. 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).
  424. </aside>
  425. </section>
  426. ```
  427. If you're using the external Markdown plugin, you can add notes with the help of a special delimiter:
  428. ```html
  429. <section data-markdown="example.md" data-separator="^\n\n\n" data-vertical="^\n\n" data-notes="^Note:"></section>
  430. # Title
  431. ## Sub-title
  432. Here is some content...
  433. Note:
  434. This will only display in the notes window.
  435. ```
  436. ## Server Side Speaker Notes
  437. 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:
  438. ```javascript
  439. Reveal.initialize({
  440. ...
  441. dependencies: [
  442. { src: 'socket.io/socket.io.js', async: true },
  443. { src: 'plugin/notes-server/client.js', async: true }
  444. ]
  445. });
  446. ```
  447. Then:
  448. 1. Install [Node.js](http://nodejs.org/)
  449. 2. Run ```npm install```
  450. 3. Run ```node plugin/notes-server```
  451. ## Multiplexing
  452. 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).
  453. The multiplex plugin needs the following 3 things to operate:
  454. 1. Master presentation that has control
  455. 2. Client presentations that follow the master
  456. 3. Socket.io server to broadcast events from the master to the clients
  457. More details:
  458. #### Master presentation
  459. 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:
  460. 1. ```npm install node-static```
  461. 2. ```static```
  462. 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.
  463. You can then access your master presentation at ```http://localhost:1947```
  464. Example configuration:
  465. ```javascript
  466. Reveal.initialize({
  467. // other options...
  468. multiplex: {
  469. // Example values. To generate your own, see the socket.io server instructions.
  470. secret: '13652805320794272084', // Obtained from the socket.io server. Gives this (the master) control of the presentation
  471. id: '1ea875674b17ca76', // Obtained from socket.io server
  472. url: 'revealjs.jit.su:80' // Location of socket.io server
  473. },
  474. // Don't forget to add the dependencies
  475. dependencies: [
  476. { src: '//cdnjs.cloudflare.com/ajax/libs/socket.io/0.9.10/socket.io.min.js', async: true },
  477. { src: 'plugin/multiplex/master.js', async: true },
  478. // and if you want speaker notes
  479. { src: 'plugin/notes-server/client.js', async: true }
  480. // other dependencies...
  481. ]
  482. });
  483. ```
  484. #### Client presentation
  485. 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.
  486. Example configuration:
  487. ```javascript
  488. Reveal.initialize({
  489. // other options...
  490. multiplex: {
  491. // Example values. To generate your own, see the socket.io server instructions.
  492. secret: null, // null so the clients do not have control of the master presentation
  493. id: '1ea875674b17ca76', // id, obtained from socket.io server
  494. url: 'revealjs.jit.su:80' // Location of socket.io server
  495. },
  496. // Don't forget to add the dependencies
  497. dependencies: [
  498. { src: '//cdnjs.cloudflare.com/ajax/libs/socket.io/0.9.10/socket.io.min.js', async: true },
  499. { src: 'plugin/multiplex/client.js', async: true }
  500. // other dependencies...
  501. ]
  502. });
  503. ```
  504. #### Socket.io server
  505. 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:
  506. 1. ```npm install```
  507. 2. ```node plugin/multiplex```
  508. Or you use the socket.io server at [http://revealjs.jit.su](http://revealjs.jit.su).
  509. 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).
  510. 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.
  511. ##### socket.io server as file static server
  512. 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.)
  513. Example configuration:
  514. ```javascript
  515. Reveal.initialize({
  516. // other options...
  517. multiplex: {
  518. // Example values. To generate your own, see the socket.io server instructions.
  519. secret: null, // null so the clients do not have control of the master presentation
  520. id: '1ea875674b17ca76', // id, obtained from socket.io server
  521. url: 'example.com:80' // Location of your socket.io server
  522. },
  523. // Don't forget to add the dependencies
  524. dependencies: [
  525. { src: '//cdnjs.cloudflare.com/ajax/libs/socket.io/0.9.10/socket.io.min.js', async: true },
  526. { src: 'plugin/multiplex/client.js', async: true }
  527. // other dependencies...
  528. ]
  529. ```
  530. 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. ;)
  531. Example configuration:
  532. ```javascript
  533. Reveal.initialize({
  534. // other options...
  535. multiplex: {
  536. // Example values. To generate your own, see the socket.io server instructions.
  537. secret: '13652805320794272084', // Obtained from the socket.io server. Gives this (the master) control of the presentation
  538. id: '1ea875674b17ca76', // Obtained from socket.io server
  539. url: 'example.com:80' // Location of your socket.io server
  540. },
  541. // Don't forget to add the dependencies
  542. dependencies: [
  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 }
  546. // other dependencies...
  547. ]
  548. });
  549. ```
  550. ## Leap Motion
  551. The Leap Motion plugin lets you utilize your [Leap Motion](https://www.leapmotion.com/) device to control basic navigation of your presentation. The gestures currently supported are:
  552. ##### 1 to 2 fingers
  553. Pointer &mdash; Point to anything on screen. Move your finger past the device to expand the pointer.
  554. ##### 1 hand + 3 or more fingers (left/right/up/down)
  555. Navigate through your slides. See config options to invert movements.
  556. ##### 2 hands upwards
  557. Toggle the overview mode. Do it a second time to exit the overview.
  558. #### Config Options
  559. You can edit the following options:
  560. | Property | Default | Description
  561. | ----------------- |:-----------------:| :-------------
  562. | autoCenter | true | Center the pointer based on where you put your finger into the leap motions detection field.
  563. | gestureDelay | 500 | How long to delay between gestures in milliseconds.
  564. | naturalSwipe | true | Swipe as though you were touching a touch screen. Set to false to invert.
  565. | pointerColor | #00aaff | The color of the pointer.
  566. | pointerOpacity | 0.7 | The opacity of the pointer.
  567. | pointerSize | 15 | The minimum height and width of the pointer.
  568. | pointerTolerance | 120 | Bigger = slower pointer.
  569. Example configuration:
  570. ```js
  571. Reveal.initialize({
  572. // other options...
  573. leap: {
  574. naturalSwipe : false, // Invert swipe gestures
  575. pointerOpacity : 0.5, // Set pointer opacity to 0.5
  576. pointerColor : '#d80000' // Red pointer
  577. },
  578. dependencies: [
  579. { src: 'plugin/leap/leap.js', async: true }
  580. ]
  581. });
  582. ```
  583. ## MathJax
  584. 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).
  585. 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.
  586. 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.
  587. ```js
  588. Reveal.initialize({
  589. // other options ...
  590. math: {
  591. mathjax: 'http://cdn.mathjax.org/mathjax/latest/MathJax.js',
  592. config: 'TeX-AMS_HTML-full' // See http://docs.mathjax.org/en/latest/config-files.html
  593. },
  594. dependencies: [
  595. { src: 'plugin/math/math.js', async: true }
  596. ]
  597. });
  598. ```
  599. 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.
  600. ## Installation
  601. 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.
  602. ### Basic setup
  603. 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.
  604. 1. Download the latest version of reveal.js from <https://github.com/hakimel/reveal.js/releases>
  605. 2. Unzip and replace the example contents in index.html with your own
  606. 3. Open index.html in a browser to view it
  607. ### Full setup
  608. 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.
  609. 1. Install [Node.js](http://nodejs.org/)
  610. 2. Install [Grunt](http://gruntjs.com/getting-started#installing-the-cli)
  611. 4. Clone the reveal.js repository
  612. ```sh
  613. $ git clone https://github.com/hakimel/reveal.js.git
  614. ```
  615. 5. Navigate to the reveal.js folder
  616. ```sh
  617. $ cd reveal.js
  618. ```
  619. 6. Install dependencies
  620. ```sh
  621. $ npm install
  622. ```
  623. 7. Serve the presentation and monitor source files for changes
  624. ```sh
  625. $ grunt serve
  626. ```
  627. 8. Open <http://localhost:8000> to view your presentation
  628. You can change the port by using `grunt serve --port 8001`.
  629. ### Folder Structure
  630. - **css/** Core styles without which the project does not function
  631. - **js/** Like above but for JavaScript
  632. - **plugin/** Components that have been developed as extensions to reveal.js
  633. - **lib/** All other third party assets (JavaScript, CSS, fonts)
  634. ### Contributing
  635. Please keep the [issue tracker](http://github.com/hakimel/reveal.js/issues) limited to **bug reports**, **feature requests** and **pull requests**. If you are reporting a bug make sure to include information about which browser and operating system you are using as well as the necessary steps to reproduce the issue.
  636. If you have personal support questions use [StackOverflow](http://stackoverflow.com/questions/tagged/reveal.js).
  637. #### Pull requests
  638. - Should follow the coding style of the file you work in, most importantly:
  639. - Tabs to indent
  640. - Single-quoted strings
  641. - Should be made towards the **dev branch**
  642. - Should be submitted from a feature/topic branch (not your master)
  643. - Should not include the minified **reveal.min.js** file
  644. ## License
  645. MIT licensed
  646. Copyright (C) 2014 Hakim El Hattab, http://hakim.se