Unverified Commit a2e69a4b authored by Hakim El Hattab's avatar Hakim El Hattab Committed by GitHub
Browse files

Merge pull request #2097 from bnjmnt4n/docs/readme

Cleanup readme to make it easier to read/edit.
parents 7991693b 1427f7a1
...@@ -4,7 +4,9 @@ A framework for easily creating beautiful presentations using HTML. [Check out t ...@@ -4,7 +4,9 @@ A framework for easily creating beautiful presentations using HTML. [Check out t
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). There's also a fully featured visual editor and platform for sharing reveal.js presentations at [slides.com](https://slides.com?ref=github). 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). There's also a fully featured visual editor and platform for sharing reveal.js presentations at [slides.com](https://slides.com?ref=github).
## Table of contents ## Table of contents
- [Online Editor](#online-editor) - [Online Editor](#online-editor)
- [Instructions](#instructions) - [Instructions](#instructions)
- [Markup](#markup) - [Markup](#markup)
...@@ -53,11 +55,13 @@ reveal.js comes with a broad range of features including [nested slides](https:/ ...@@ -53,11 +55,13 @@ reveal.js comes with a broad range of features including [nested slides](https:/
- [License](#license) - [License](#license)
#### More reading #### More reading
- [Changelog](https://github.com/hakimel/reveal.js/releases): Up-to-date version history. - [Changelog](https://github.com/hakimel/reveal.js/releases): Up-to-date version history.
- [Examples](https://github.com/hakimel/reveal.js/wiki/Example-Presentations): Presentations created with reveal.js, add your own! - [Examples](https://github.com/hakimel/reveal.js/wiki/Example-Presentations): Presentations created with reveal.js, add your own!
- [Browser Support](https://github.com/hakimel/reveal.js/wiki/Browser-Support): Explanation of browser support and fallbacks. - [Browser Support](https://github.com/hakimel/reveal.js/wiki/Browser-Support): Explanation of browser support and fallbacks.
- [Plugins](https://github.com/hakimel/reveal.js/wiki/Plugins,-Tools-and-Hardware): A list of plugins that can be used to extend reveal.js. - [Plugins](https://github.com/hakimel/reveal.js/wiki/Plugins,-Tools-and-Hardware): A list of plugins that can be used to extend reveal.js.
## Online Editor ## Online Editor
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 [https://slides.com](https://slides.com?ref=github). 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 [https://slides.com](https://slides.com?ref=github).
...@@ -121,7 +125,7 @@ This is based on [data-markdown](https://gist.github.com/1343518) from [Paul Iri ...@@ -121,7 +125,7 @@ This is based on [data-markdown](https://gist.github.com/1343518) from [Paul Iri
#### External Markdown #### External Markdown
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-separator` attribute defines a regular expression for horizontal slides (defaults to `^\r?\n---\r?\n$`, a newline-bounded horizontal rule) and `data-separator-vertical` defines vertical slides (disabled by default). The `data-separator-notes` attribute is a regular expression for specifying the beginning of the current slide's speaker notes (defaults to `note:`). The `data-charset` attribute is optional and specifies which charset to use when loading the external file. 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-separator` attribute defines a regular expression for horizontal slides (defaults to `^\r?\n---\r?\n$`, a newline-bounded horizontal rule) and `data-separator-vertical` defines vertical slides (disabled by default). The `data-separator-notes` attribute is a regular expression for specifying the beginning of the current slide's speaker notes (defaults to `notes?:`). The `data-charset` attribute is optional and specifies which charset to use when loading the external file.
When used locally, this feature requires that reveal.js [runs from a local web server](#full-setup). The following example customises all available options: When used locally, this feature requires that reveal.js [runs from a local web server](#full-setup). The following example customises all available options:
...@@ -140,7 +144,7 @@ When used locally, this feature requires that reveal.js [runs from a local web s ...@@ -140,7 +144,7 @@ When used locally, this feature requires that reveal.js [runs from a local web s
#### Element Attributes #### Element Attributes
Special syntax (in html comment) is available for adding attributes to Markdown elements. This is useful for fragments, amongst other things. Special syntax (through HTML comments) is available for adding attributes to Markdown elements. This is useful for fragments, amongst other things.
```html ```html
<section data-markdown> <section data-markdown>
...@@ -153,7 +157,7 @@ Special syntax (in html comment) is available for adding attributes to Markdown ...@@ -153,7 +157,7 @@ Special syntax (in html comment) is available for adding attributes to Markdown
#### Slide Attributes #### Slide Attributes
Special syntax (in html comment) is available for adding attributes to the slide `<section>` elements generated by your Markdown. Special syntax (through HTML comments) is available for adding attributes to the slide `<section>` elements generated by your Markdown.
```html ```html
<section data-markdown> <section data-markdown>
...@@ -180,7 +184,7 @@ Reveal.initialize({ ...@@ -180,7 +184,7 @@ Reveal.initialize({
### Configuration ### Configuration
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. At the end of your page you need to initialize reveal by running the following code. Note that all configuration values are optional and will default to the values specified below.
```javascript ```javascript
Reveal.initialize({ Reveal.initialize({
...@@ -304,8 +308,7 @@ Reveal.initialize({ ...@@ -304,8 +308,7 @@ Reveal.initialize({
}); });
``` ```
The configuration can be updated after initialization using the `configure` method:
The configuration can be updated after initialization using the ```configure``` method:
```javascript ```javascript
// Turn autoSlide off // Turn autoSlide off
...@@ -315,17 +318,16 @@ Reveal.configure({ autoSlide: 0 }); ...@@ -315,17 +318,16 @@ Reveal.configure({ autoSlide: 0 });
Reveal.configure({ autoSlide: 5000 }); Reveal.configure({ autoSlide: 5000 });
``` ```
### Presentation Size ### Presentation Size
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. 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.
See below for a list of configuration options related to sizing, including default values: See below for a list of configuration options related to sizing, including default values:
```javascript ```javascript
Reveal.initialize({ Reveal.initialize({
... // ...
// The "normal" size of the presentation, aspect ratio will be preserved // The "normal" size of the presentation, aspect ratio will be preserved
// when the presentation is scaled to fit different resolutions. Can be // when the presentation is scaled to fit different resolutions. Can be
...@@ -348,7 +350,7 @@ If you wish to disable this behavior and do your own scaling (e.g. using media q ...@@ -348,7 +350,7 @@ If you wish to disable this behavior and do your own scaling (e.g. using media q
```javascript ```javascript
Reveal.initialize({ Reveal.initialize({
... // ...
width: "100%", width: "100%",
height: "100%", height: "100%",
...@@ -397,7 +399,7 @@ To load these dependencies, reveal.js requires [head.js](http://headjs.com/) *(a ...@@ -397,7 +399,7 @@ To load these dependencies, reveal.js requires [head.js](http://headjs.com/) *(a
### Ready Event ### Ready Event
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()`. 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()`.
```javascript ```javascript
Reveal.addEventListener( 'ready', function( event ) { Reveal.addEventListener( 'ready', function( event ) {
...@@ -417,9 +419,10 @@ Reveal.configure({ ...@@ -417,9 +419,10 @@ Reveal.configure({
autoSlide: 5000 autoSlide: 5000
}); });
``` ```
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.
You can also override the slide duration for individual slides and fragments by using the ```data-autoslide``` attribute: 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.
You can also override the slide duration for individual slides and fragments by using the `data-autoslide` attribute:
```html ```html
<section data-autoslide="2000"> <section data-autoslide="2000">
...@@ -429,14 +432,13 @@ You can also override the slide duration for individual slides and fragments by ...@@ -429,14 +432,13 @@ You can also override the slide duration for individual slides and fragments by
</section> </section>
``` ```
To override the method used for navigation when auto-sliding, you can specify the ```autoSlideMethod``` setting. To only navigate along the top layer and ignore vertical slides, set this to ```Reveal.navigateRight```. To override the method used for navigation when auto-sliding, you can specify the `autoSlideMethod` setting. To only navigate along the top layer and ignore vertical slides, set this to `Reveal.navigateRight`.
Whenever the auto-slide mode is resumed or paused the ```autoslideresumed``` and ```autoslidepaused``` events are fired.
Whenever the auto-slide mode is resumed or paused the `autoslideresumed` and `autoslidepaused` events are fired.
### Keyboard Bindings ### Keyboard Bindings
If you're unhappy with any of the default keyboard bindings you can override them using the ```keyboard``` config option: If you're unhappy with any of the default keyboard bindings you can override them using the `keyboard` config option:
```javascript ```javascript
Reveal.configure({ Reveal.configure({
...@@ -454,12 +456,11 @@ You can swipe to navigate through a presentation on any touch-enabled device. Ho ...@@ -454,12 +456,11 @@ You can swipe to navigate through a presentation on any touch-enabled device. Ho
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. 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.
### Lazy Loading ### Lazy Loading
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. 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.
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. 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.
```html ```html
<section> <section>
...@@ -472,10 +473,9 @@ To enable lazy loading all you need to do is change your "src" attributes to "da ...@@ -472,10 +473,9 @@ To enable lazy loading all you need to do is change your "src" attributes to "da
</section> </section>
``` ```
### API ### API
The ``Reveal`` object exposes a JavaScript API for controlling navigation and reading state: The `Reveal` object exposes a JavaScript API for controlling navigation and reading state:
```javascript ```javascript
// Navigation // Navigation
...@@ -514,11 +514,11 @@ Reveal.getScale(); ...@@ -514,11 +514,11 @@ Reveal.getScale();
Reveal.getPreviousSlide(); Reveal.getPreviousSlide();
Reveal.getCurrentSlide(); Reveal.getCurrentSlide();
Reveal.getIndices(); // { h: 0, v: 0 } } Reveal.getIndices(); // { h: 0, v: 0, f: 0 }
Reveal.getPastSlideCount(); Reveal.getSlidePastCount();
Reveal.getProgress(); // (0 == first slide, 1 == last slide) Reveal.getProgress(); // (0 == first slide, 1 == last slide)
Reveal.getSlides(); // Array of all slides Reveal.getSlides(); // Array of all slides
Reveal.getTotalSlides(); // total number of slides Reveal.getTotalSlides(); // Total number of slides
// Returns the speaker notes for the current slide // Returns the speaker notes for the current slide
Reveal.getSlideNotes(); Reveal.getSlideNotes();
...@@ -533,7 +533,7 @@ Reveal.isAutoSliding(); ...@@ -533,7 +533,7 @@ Reveal.isAutoSliding();
### Slide Changed Event ### Slide Changed Event
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. 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.
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. 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.
...@@ -562,7 +562,7 @@ Reveal.setState( state ); ...@@ -562,7 +562,7 @@ Reveal.setState( state );
### Slide States ### Slide States
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. 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.
Furthermore you can also listen to these changes in state via JavaScript: Furthermore you can also listen to these changes in state via JavaScript:
...@@ -574,10 +574,12 @@ Reveal.addEventListener( 'somestate', function() { ...@@ -574,10 +574,12 @@ Reveal.addEventListener( 'somestate', function() {
### Slide Backgrounds ### Slide Backgrounds
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. 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.
#### Color Backgrounds #### Color Backgrounds
All CSS color formats are supported, like rgba() or hsl().
All CSS color formats are supported, including hex values, keywords, `rgba()` or `hsl()`.
```html ```html
<section data-background-color="#ff0000"> <section data-background-color="#ff0000">
<h2>Color</h2> <h2>Color</h2>
...@@ -585,6 +587,7 @@ All CSS color formats are supported, like rgba() or hsl(). ...@@ -585,6 +587,7 @@ All CSS color formats are supported, like rgba() or hsl().
``` ```
#### Image Backgrounds #### Image Backgrounds
By default, background images are resized to cover the full page. Available options: By default, background images are resized to cover the full page. Available options:
| Attribute | Default | Description | | Attribute | Default | Description |
...@@ -593,6 +596,7 @@ By default, background images are resized to cover the full page. Available opti ...@@ -593,6 +596,7 @@ By default, background images are resized to cover the full page. Available opti
| data-background-size | cover | See [background-size](https://developer.mozilla.org/docs/Web/CSS/background-size) on MDN. | | data-background-size | cover | See [background-size](https://developer.mozilla.org/docs/Web/CSS/background-size) on MDN. |
| data-background-position | center | See [background-position](https://developer.mozilla.org/docs/Web/CSS/background-position) on MDN. | | data-background-position | center | See [background-position](https://developer.mozilla.org/docs/Web/CSS/background-position) on MDN. |
| data-background-repeat | no-repeat | See [background-repeat](https://developer.mozilla.org/docs/Web/CSS/background-repeat) on MDN. | | data-background-repeat | no-repeat | See [background-repeat](https://developer.mozilla.org/docs/Web/CSS/background-repeat) on MDN. |
```html ```html
<section data-background-image="http://example.com/image.png"> <section data-background-image="http://example.com/image.png">
<h2>Image</h2> <h2>Image</h2>
...@@ -603,6 +607,7 @@ By default, background images are resized to cover the full page. Available opti ...@@ -603,6 +607,7 @@ By default, background images are resized to cover the full page. Available opti
``` ```
#### Video Backgrounds #### Video Backgrounds
Automatically plays a full size video behind the slide. Automatically plays a full size video behind the slide.
| Attribute | Default | Description | | Attribute | Default | Description |
...@@ -619,7 +624,9 @@ Automatically plays a full size video behind the slide. ...@@ -619,7 +624,9 @@ Automatically plays a full size video behind the slide.
``` ```
#### Iframe Backgrounds #### Iframe Backgrounds
Embeds a web page as a slide background that covers 100% of the reveal.js width and height. The iframe is in the background layer, behind your slides, and as such it's not possible to interact with it by default. To make your background interactive, you can add the `data-background-interactive` attribute. Embeds a web page as a slide background that covers 100% of the reveal.js width and height. The iframe is in the background layer, behind your slides, and as such it's not possible to interact with it by default. To make your background interactive, you can add the `data-background-interactive` attribute.
```html ```html
<section data-background-iframe="https://slides.com" data-background-interactive> <section data-background-iframe="https://slides.com" data-background-interactive>
<h2>Iframe</h2> <h2>Iframe</h2>
...@@ -627,12 +634,13 @@ Embeds a web page as a slide background that covers 100% of the reveal.js width ...@@ -627,12 +634,13 @@ Embeds a web page as a slide background that covers 100% of the reveal.js width
``` ```
#### Background Transitions #### Background Transitions
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.
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.
### Parallax Background ### Parallax Background
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). If you want to use a parallax scrolling background, set the first two properties below when initializing reveal.js (the other two are optional).
```javascript ```javascript
Reveal.initialize({ Reveal.initialize({
...@@ -654,10 +662,9 @@ Reveal.initialize({ ...@@ -654,10 +662,9 @@ Reveal.initialize({
Make sure that the background size is much bigger than screen size to allow for some scrolling. [View example](http://revealjs.com/?parallaxBackgroundImage=https%3A%2F%2Fs3.amazonaws.com%2Fhakim-static%2Freveal-js%2Freveal-parallax-1.jpg&parallaxBackgroundSize=2100px%20900px). Make sure that the background size is much bigger than screen size to allow for some scrolling. [View example](http://revealjs.com/?parallaxBackgroundImage=https%3A%2F%2Fs3.amazonaws.com%2Fhakim-static%2Freveal-js%2Freveal-parallax-1.jpg&parallaxBackgroundSize=2100px%20900px).
### Slide Transitions ### Slide Transitions
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:
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:
```html ```html
<section data-transition="zoom"> <section data-transition="zoom">
...@@ -689,17 +696,16 @@ You can also use different in and out transitions for the same slide: ...@@ -689,17 +696,16 @@ You can also use different in and out transitions for the same slide:
</section> </section>
``` ```
### Internal links ### Internal links
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">```): 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">`):
```html ```html
<a href="#/2/2">Link</a> <a href="#/2/2">Link</a>
<a href="#/some-slide">Link</a> <a href="#/some-slide">Link</a>
``` ```
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. 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.
```html ```html
<a href="#" class="navigate-left"> <a href="#" class="navigate-left">
...@@ -710,9 +716,9 @@ You can also add relative navigation links, similar to the built in reveal.js co ...@@ -710,9 +716,9 @@ You can also add relative navigation links, similar to the built in reveal.js co
<a href="#" class="navigate-next"> <!-- Next vertical or horizontal slide --> <a href="#" class="navigate-next"> <!-- Next vertical or horizontal slide -->
``` ```
### Fragments ### Fragments
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://revealjs.com/#/fragments
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://revealjs.com/#/fragments
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: 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:
...@@ -740,7 +746,7 @@ Multiple fragments can be applied to the same element sequentially by wrapping i ...@@ -740,7 +746,7 @@ Multiple fragments can be applied to the same element sequentially by wrapping i
</section> </section>
``` ```
The display order of fragments can be controlled using the ```data-fragment-index``` attribute. The display order of fragments can be controlled using the `data-fragment-index` attribute.
```html ```html
<section> <section>
...@@ -769,6 +775,15 @@ Reveal.addEventListener( 'fragmenthidden', function( event ) { ...@@ -769,6 +775,15 @@ Reveal.addEventListener( 'fragmenthidden', function( event ) {
By default, Reveal is configured with [highlight.js](https://highlightjs.org/) for code syntax highlighting. To enable syntax highlighting, you'll have to load the highlight plugin ([plugin/highlight/highlight.js](plugin/highlight/highlight.js)) and a highlight.js CSS theme (Reveal comes packaged with the zenburn theme: [lib/css/zenburn.css](lib/css/zenburn.css)). By default, Reveal is configured with [highlight.js](https://highlightjs.org/) for code syntax highlighting. To enable syntax highlighting, you'll have to load the highlight plugin ([plugin/highlight/highlight.js](plugin/highlight/highlight.js)) and a highlight.js CSS theme (Reveal comes packaged with the zenburn theme: [lib/css/zenburn.css](lib/css/zenburn.css)).
```javascript
Reveal.initialize({
// More info https://github.com/hakimel/reveal.js#dependencies
dependencies: [
{ src: 'plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
]
});
```
Below is an example with clojure code that will be syntax highlighted. When the `data-trim` attribute is present, surrounding whitespace is automatically removed. HTML will be escaped by default. To avoid this, for example if you are using `<mark>` to call out a line of code, add the `data-noescape` attribute to the `<code>` element. Below is an example with clojure code that will be syntax highlighted. When the `data-trim` attribute is present, surrounding whitespace is automatically removed. HTML will be escaped by default. To avoid this, for example if you are using `<mark>` to call out a line of code, add the `data-noescape` attribute to the `<code>` element.
```html ```html
...@@ -784,7 +799,8 @@ Below is an example with clojure code that will be syntax highlighted. When the ...@@ -784,7 +799,8 @@ Below is an example with clojure code that will be syntax highlighted. When the
``` ```
### Slide number ### Slide number
If you would like to display the page number of the current slide you can do so using the ```slideNumber``` and ```showSlideNumber``` configuration values.
If you would like to display the page number of the current slide you can do so using the `slideNumber` and `showSlideNumber` configuration values.
```javascript ```javascript
// Shows the slide number using default formatting // Shows the slide number using default formatting
...@@ -802,13 +818,11 @@ Reveal.configure({ slideNumber: 'c/t' }); ...@@ -802,13 +818,11 @@ Reveal.configure({ slideNumber: 'c/t' });
// "speaker": only show slide numbers on speaker notes view // "speaker": only show slide numbers on speaker notes view
// "print": only show slide numbers when printing to PDF // "print": only show slide numbers when printing to PDF
Reveal.configure({ showSlideNumber: 'speaker' }); Reveal.configure({ showSlideNumber: 'speaker' });
``` ```
### Overview mode ### Overview mode
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, 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,
as if you were at 1,000 feet above your presentation. The overview mode comes with a few API hooks: as if you were at 1,000 feet above your presentation. The overview mode comes with a few API hooks:
```javascript ```javascript
...@@ -819,12 +833,12 @@ Reveal.addEventListener( 'overviewhidden', function( event ) { /* ... */ } ); ...@@ -819,12 +833,12 @@ Reveal.addEventListener( 'overviewhidden', function( event ) { /* ... */ } );
Reveal.toggleOverview(); Reveal.toggleOverview();
``` ```
### Fullscreen mode ### Fullscreen mode
Just press »F« on your keyboard to show your presentation in fullscreen mode. Press the »ESC« key to exit fullscreen mode.
Just press »F« on your keyboard to show your presentation in fullscreen mode. Press the »ESC« key to exit fullscreen mode.
### Embedded media ### Embedded media
Add `data-autoplay` to your media element if you want it to automatically start playing when the slide is shown: Add `data-autoplay` to your media element if you want it to automatically start playing when the slide is shown:
```html ```html
...@@ -835,14 +849,13 @@ If you want to enable or disable autoplay globally, for all embedded media, you ...@@ -835,14 +849,13 @@ If you want to enable or disable autoplay globally, for all embedded media, you
Note that embedded HTML5 `<video>`/`<audio>` and YouTube/Vimeo iframes are automatically paused when you navigate away from a slide. This can be disabled by decorating your element with a `data-ignore` attribute. Note that embedded HTML5 `<video>`/`<audio>` and YouTube/Vimeo iframes are automatically paused when you navigate away from a slide. This can be disabled by decorating your element with a `data-ignore` attribute.
### Embedded iframes ### Embedded iframes
reveal.js automatically pushes two [post messages](https://developer.mozilla.org/en-US/docs/Web/API/Window.postMessage) to embedded iframes. ```slide:start``` when the slide containing the iframe is made visible and ```slide:stop``` when it is hidden. reveal.js automatically pushes two [post messages](https://developer.mozilla.org/en-US/docs/Web/API/Window.postMessage) to embedded iframes. `slide:start` when the slide containing the iframe is made visible and `slide:stop` when it is hidden.
### Stretching elements ### Stretching elements
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:
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:
```html ```html
<section> <section>
...@@ -855,8 +868,8 @@ Limitations: ...@@ -855,8 +868,8 @@ Limitations:
- Only direct descendants of a slide section can be stretched - Only direct descendants of a slide section can be stretched
- Only one descendant per slide section can be stretched - Only one descendant per slide section can be stretched
### postMessage API ### postMessage API
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: 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:
```javascript ```javascript
...@@ -878,7 +891,7 @@ This cross-window messaging can be toggled on or off using configuration flags. ...@@ -878,7 +891,7 @@ This cross-window messaging can be toggled on or off using configuration flags.
```javascript ```javascript
Reveal.initialize({ Reveal.initialize({
..., // ...
// Exposes the reveal.js API through window.postMessage // Exposes the reveal.js API through window.postMessage
postMessage: true, postMessage: true,
...@@ -895,9 +908,11 @@ Presentations can be exported to PDF via a special print stylesheet. This featur ...@@ -895,9 +908,11 @@ Presentations can be exported to PDF via a special print stylesheet. This featur
Here's an example of an exported presentation that's been uploaded to SlideShare: http://www.slideshare.net/hakimel/revealjs-300. Here's an example of an exported presentation that's been uploaded to SlideShare: http://www.slideshare.net/hakimel/revealjs-300.
### Page size ### Page size
Export dimensions are inferred from the configured [presentation size](#presentation-size). Slides that are too tall to fit within a single page will expand onto multiple pages. You can limit how many pages a slide may expand onto using the `pdfMaxPagesPerSlide` config option, for example `Reveal.configure({ pdfMaxPagesPerSlide: 1 })` ensures that no slide ever grows to more than one printed page. Export dimensions are inferred from the configured [presentation size](#presentation-size). Slides that are too tall to fit within a single page will expand onto multiple pages. You can limit how many pages a slide may expand onto using the `pdfMaxPagesPerSlide` config option, for example `Reveal.configure({ pdfMaxPagesPerSlide: 1 })` ensures that no slide ever grows to more than one printed page.
### Print stylesheet ### Print stylesheet
To enable the PDF print capability in your presentation, the special print stylesheet at [/css/print/pdf.css](https://github.com/hakimel/reveal.js/blob/master/css/print/pdf.css) must be loaded. The default index.html file handles this for you when `print-pdf` is included in the query string. If you're using a different HTML template, you can add this to your HEAD: To enable the PDF print capability in your presentation, the special print stylesheet at [/css/print/pdf.css](https://github.com/hakimel/reveal.js/blob/master/css/print/pdf.css) must be loaded. The default index.html file handles this for you when `print-pdf` is included in the query string. If you're using a different HTML template, you can add this to your HEAD:
```html ```html
...@@ -911,6 +926,7 @@ To enable the PDF print capability in your presentation, the special print style ...@@ -911,6 +926,7 @@ To enable the PDF print capability in your presentation, the special print style
``` ```
### Instructions ### Instructions
1. Open your presentation with `print-pdf` included in the query string i.e. http://localhost:8000/?print-pdf. You can test this with [revealjs.com?print-pdf](http://revealjs.com?print-pdf). 1. Open your presentation with `print-pdf` included in the query string i.e. http://localhost:8000/?print-pdf. You can test this with [revealjs.com?print-pdf](http://revealjs.com?print-pdf).
* If you want to include [speaker notes](#speaker-notes) in your export, you can append `showNotes=true` to the query string: http://localhost:8000/?print-pdf&showNotes=true * If you want to include [speaker notes](#speaker-notes) in your export, you can append `showNotes=true` to the query string: http://localhost:8000/?print-pdf&showNotes=true
1. Open the in-browser print dialog (CTRL/CMD+P). 1. Open the in-browser print dialog (CTRL/CMD+P).
...@@ -924,6 +940,7 @@ To enable the PDF print capability in your presentation, the special print style ...@@ -924,6 +940,7 @@ To enable the PDF print capability in your presentation, the special print style
Alternatively you can use the [decktape](https://github.com/astefanutti/decktape) project. Alternatively you can use the [decktape](https://github.com/astefanutti/decktape) project.
## Theming ## Theming
The framework comes with a few different themes included: The framework comes with a few different themes included:
...@@ -949,11 +966,11 @@ If you want to add a theme of your own see the instructions here: [/css/theme/RE ...@@ -949,11 +966,11 @@ If you want to add a theme of your own see the instructions here: [/css/theme/RE
## Speaker Notes ## Speaker Notes
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. 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.
A speaker timer starts as soon as the speaker view is opened. You can reset it to 00:00:00 at any time by simply clicking/tapping on it. A speaker timer starts as soon as the speaker view is opened. You can reset it to 00:00:00 at any time by simply clicking/tapping on it.