annotate www/p/README.md @ 101:52e44ee1c791 tip master

enabled all scores in autostart script
author Rob Canning <rc@kiben.net>
date Tue, 21 Apr 2015 16:20:57 +0100
parents 49c94f63b8b0
children
rev   line source
rc-web@42 1 # reveal.js
rc-web@42 2
rc-web@42 3 A framework for easily creating beautiful presentations using HTML. [Check out the live demo](http://lab.hakim.se/reveal-js/).
rc-web@42 4
rc-web@42 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.
rc-web@42 6
rc-web@42 7
rc-web@42 8 #### More reading in the Wiki:
rc-web@42 9 - [Changelog](https://github.com/hakimel/reveal.js/wiki/Changelog): Up-to-date version history.
rc-web@42 10 - [Examples](https://github.com/hakimel/reveal.js/wiki/Example-Presentations): Presentations created with reveal.js, add your own!
rc-web@42 11 - [Browser Support](https://github.com/hakimel/reveal.js/wiki/Changelog): Explanation of browser support and fallbacks.
rc-web@42 12
rc-web@42 13
rc-web@42 14 ## Instructions
rc-web@42 15
rc-web@42 16 ### Markup
rc-web@42 17
rc-web@42 18 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:
rc-web@42 19
rc-web@42 20 ```html
rc-web@42 21 <div class="reveal">
rc-web@42 22 <div class="slides">
rc-web@42 23 <section>Single Horizontal Slide</section>
rc-web@42 24 <section>
rc-web@42 25 <section>Vertical Slide 1</section>
rc-web@42 26 <section>Vertical Slide 2</section>
rc-web@42 27 </section>
rc-web@42 28 </div>
rc-web@42 29 </div>
rc-web@42 30 ```
rc-web@42 31
rc-web@42 32 ### Markdown
rc-web@42 33
rc-web@42 34 It's possible to write your slides using Markdown. To enable Markdown simply add the ```data-markdown``` attribute to your ```<section>``` elements and reveal.js will automatically load the JavaScript parser.
rc-web@42 35
rc-web@42 36 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/). This is sensitive to indentation (avoid mixing tabs and spaces) and line breaks (avoid consecutive breaks). Updates to come.
rc-web@42 37
rc-web@42 38 ```html
rc-web@42 39 <section data-markdown>
rc-web@42 40 ## Page title
rc-web@42 41
rc-web@42 42 A paragraph with some text and a [link](http://hakim.se).
rc-web@42 43 </section>
rc-web@42 44 ```
rc-web@42 45
rc-web@42 46
rc-web@42 47 ### Configuration
rc-web@42 48
rc-web@42 49 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.
rc-web@42 50
rc-web@42 51 ```javascript
rc-web@42 52 Reveal.initialize({
rc-web@42 53 // Display controls in the bottom right corner
rc-web@42 54 controls: true,
rc-web@42 55
rc-web@42 56 // Display a presentation progress bar
rc-web@42 57 progress: true,
rc-web@42 58
rc-web@42 59 // Push each slide change to the browser history
rc-web@42 60 history: false,
rc-web@42 61
rc-web@42 62 // Enable keyboard shortcuts for navigation
rc-web@42 63 keyboard: true,
rc-web@42 64
rc-web@42 65 // Loop the presentation
rc-web@42 66 loop: false,
rc-web@42 67
rc-web@42 68 // Number of milliseconds between automatically proceeding to the
rc-web@42 69 // next slide, disabled when set to 0
rc-web@42 70 autoSlide: 0,
rc-web@42 71
rc-web@42 72 // Enable slide navigation via mouse wheel
rc-web@42 73 mouseWheel: true,
rc-web@42 74
rc-web@42 75 // Apply a 3D roll to links on hover
rc-web@42 76 rollingLinks: true,
rc-web@42 77
rc-web@42 78 // Transition style
rc-web@42 79 transition: 'default' // default/cube/page/concave/linear(2d)
rc-web@42 80 });
rc-web@42 81 ```
rc-web@42 82
rc-web@42 83 ### Dependencies
rc-web@42 84
rc-web@42 85 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:
rc-web@42 86
rc-web@42 87 ```javascript
rc-web@42 88 Reveal.initialize({
rc-web@42 89 dependencies: [
rc-web@42 90 // Syntax highlight for <code> elements
rc-web@42 91 { src: 'lib/js/highlight.js', async: true, callback: function() { window.hljs.initHighlightingOnLoad(); } },
rc-web@42 92 // Cross-browser shim that fully implements classList - https://github.com/eligrey/classList.js/
rc-web@42 93 { src: 'lib/js/classList.js', condition: function() { return !document.body.classList; } }
rc-web@42 94 // Interpret Markdown in <section> elements
rc-web@42 95 { src: 'lib/js/data-markdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
rc-web@42 96 { src: 'lib/js/showdown.js', condition: function() { return !!document.querySelector( '[data-markdown]' ); } },
rc-web@42 97 // Speaker notes support
rc-web@42 98 { src: 'plugin/speakernotes/client.js', async: true, condition: function() { return window.location.host === 'localhost:1947'; } },
rc-web@42 99 { src: 'socket.io/socket.io.js', async: true, condition: function() { return window.location.host === 'localhost:1947'; } },
rc-web@42 100 ]
rc-web@42 101 });
rc-web@42 102 ```
rc-web@42 103
rc-web@42 104 You can add your own extensions using the same syntax. The following properties are available for each dependency object:
rc-web@42 105 - **src**: Path to the script to load
rc-web@42 106 - **async**: [optional] Flags if the script should load after reveal.js has started, defaults to false
rc-web@42 107 - **callback**: [optional] Function to execute when the script has loaded
rc-web@42 108 - **condition**: [optional] Function which must return true for the script to be loaded
rc-web@42 109
rc-web@42 110
rc-web@42 111 ### API
rc-web@42 112
rc-web@42 113 The Reveal class provides a minimal JavaScript API for controlling navigation and reading state:
rc-web@42 114
rc-web@42 115 ```javascript
rc-web@42 116 // Navigation
rc-web@42 117 Reveal.navigateTo( indexh, indexv );
rc-web@42 118 Reveal.navigateLeft();
rc-web@42 119 Reveal.navigateRight();
rc-web@42 120 Reveal.navigateUp();
rc-web@42 121 Reveal.navigateDown();
rc-web@42 122 Reveal.navigatePrev();
rc-web@42 123 Reveal.navigateNext();
rc-web@42 124 Reveal.toggleOverview();
rc-web@42 125
rc-web@42 126 // Retrieves the previous and current slide elements
rc-web@42 127 Reveal.getPreviousSlide();
rc-web@42 128 Reveal.getCurrentSlide();
rc-web@42 129
rc-web@42 130 Reveal.getIndices(); // { h: 0, v: 0 } }
rc-web@42 131 ```
rc-web@42 132
rc-web@42 133 ### States
rc-web@42 134
rc-web@42 135 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.
rc-web@42 136
rc-web@42 137 Furthermore you can also listen to these changes in state via JavaScript:
rc-web@42 138
rc-web@42 139 ```javascript
rc-web@42 140 Reveal.addEventListener( 'somestate', function() {
rc-web@42 141 // TODO: Sprinkle magic
rc-web@42 142 }, false );
rc-web@42 143 ```
rc-web@42 144
rc-web@42 145 ### Slide change event
rc-web@42 146
rc-web@42 147 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.
rc-web@42 148
rc-web@42 149 ```javascript
rc-web@42 150 Reveal.addEventListener( 'slidechanged', function( event ) {
rc-web@42 151 // event.previousSlide, event.currentSlide, event.indexh, event.indexv
rc-web@42 152 } );
rc-web@42 153 ```
rc-web@42 154
rc-web@42 155 ### Fragment events
rc-web@42 156
rc-web@42 157 When a slide fragment is either shown or hidden reveal.js will dispatch an event.
rc-web@42 158
rc-web@42 159 ```javascript
rc-web@42 160 Reveal.addEventListener( 'fragmentshown', function( event ) {
rc-web@42 161 // event.fragment = the fragment DOM element
rc-web@42 162 } );
rc-web@42 163 Reveal.addEventListener( 'fragmenthidden', function( event ) {
rc-web@42 164 // event.fragment = the fragment DOM element
rc-web@42 165 } );
rc-web@42 166 ```
rc-web@42 167
rc-web@42 168 ### Internal links
rc-web@42 169
rc-web@42 170 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">```):
rc-web@42 171
rc-web@42 172 ```html
rc-web@42 173 <a href="#/2/2">Link</a>
rc-web@42 174 <a href="#/some-slide">Link</a>
rc-web@42 175 ```
rc-web@42 176
rc-web@42 177 ## PDF Export
rc-web@42 178
rc-web@42 179 Presentations can be exported to PDF via a special print stylesheet. This feature requires that you use [Google Chrome](http://google.com/chrome).
rc-web@42 180 Here's an example of an exported presentation that's been uploaded to SlideShare: http://www.slideshare.net/hakimel/revealjs-13872948.
rc-web@42 181
rc-web@42 182 1. Open the desired presentation with *print-pdf* anywhere in the query, for example: [lab.hakim.se/reveal-js?print-pdf](http://lab.hakim.se/reveal-js?print-pdf)
rc-web@42 183 2. Open the in-browser print dialog (CMD+P).
rc-web@42 184 3. Change the **Destination** setting to **Save as PDF**.
rc-web@42 185 4. Change the **Layout** to **Landscape**.
rc-web@42 186 5. Change the **Margins** to **None**.
rc-web@42 187 6. Click **Save**.
rc-web@42 188
rc-web@42 189 ![Chrome Print Settings](https://s3.amazonaws.com/hakim-static/reveal-js/pdf-print-settings.png)
rc-web@42 190
rc-web@42 191 ## Speaker Notes
rc-web@42 192
rc-web@42 193 If you're interested in using speaker notes, reveal.js comes with a Node server that allows you to deliver your presentation in one browser while viewing speaker notes in another.
rc-web@42 194
rc-web@42 195 To include speaker notes in your presentation, simply add an `<aside class="notes">` element to any slide. These notes will be hidden in the main presentation view.
rc-web@42 196
rc-web@42 197 You'll also need to [install Node.js](http://nodejs.org/); then, install the server dependencies by running `npm install`.
rc-web@42 198
rc-web@42 199 Once Node.js and the dependencies are installed, run the following command from the root directory:
rc-web@42 200
rc-web@42 201 node plugin/speakernotes
rc-web@42 202
rc-web@42 203 By default, the slides will be served at [localhost:1947](http://localhost:1947).
rc-web@42 204
rc-web@42 205 You can change the appearance of the speaker notes by editing the file at `plugin/speakernotes/notes.html`.
rc-web@42 206
rc-web@42 207 ### Known Issues
rc-web@42 208
rc-web@42 209 - The notes page is supposed to show the current slide and the next slide, but when it first starts, it always shows the first slide in both positions.
rc-web@42 210
rc-web@42 211 ## Folder Structure
rc-web@42 212 - **css/** Core styles without which the project does not function
rc-web@42 213 - **js/** Like above but for JavaScript
rc-web@42 214 - **plugin/** Components that have been developed as extensions to reveal.js
rc-web@42 215 - **lib/** All other third party assets (JavaScript, CSS, fonts)
rc-web@42 216
rc-web@42 217 ## License
rc-web@42 218
rc-web@42 219 MIT licensed
rc-web@42 220
rc-web@42 221 Copyright (C) 2011-2012 Hakim El Hattab, http://hakim.se