From 1427f7a1aef53908a4e2c3ca8d9e7a403f674b30 Mon Sep 17 00:00:00 2001 From: Benjamin Tan Date: Wed, 14 Feb 2018 18:36:18 +0800 Subject: [PATCH] Cleanup readme to make it easier to read/edit. - Use `single backticks` consistently for inline code snippets. - Add double linefeeds before level 2 headings. - Add a single linefeed after each heading. - Minor docs edits. --- README.md | 172 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 95 insertions(+), 77 deletions(-) diff --git a/README.md b/README.md index f2ab6ca8..857f39cb 100644 --- a/README.md +++ b/README.md @@ -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). + ## Table of contents + - [Online Editor](#online-editor) - [Instructions](#instructions) - [Markup](#markup) @@ -53,11 +55,13 @@ reveal.js comes with a broad range of features including [nested slides](https:/ - [License](#license) #### More reading + - [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! - [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. + ## 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). @@ -121,7 +125,7 @@ This is based on [data-markdown](https://gist.github.com/1343518) from [Paul Iri #### 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: @@ -140,7 +144,7 @@ When used locally, this feature requires that reveal.js [runs from a local web s #### 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
@@ -153,7 +157,7 @@ Special syntax (in html comment) is available for adding attributes to Markdown #### Slide Attributes -Special syntax (in html comment) is available for adding attributes to the slide `
` elements generated by your Markdown. +Special syntax (through HTML comments) is available for adding attributes to the slide `
` elements generated by your Markdown. ```html
@@ -180,7 +184,7 @@ Reveal.initialize({ ### 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 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 // Turn autoSlide off @@ -315,17 +318,16 @@ Reveal.configure({ autoSlide: 0 }); Reveal.configure({ autoSlide: 5000 }); ``` - ### 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: ```javascript Reveal.initialize({ - ... + // ... // The "normal" size of the presentation, aspect ratio will be preserved // 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 ```javascript Reveal.initialize({ - ... + // ... width: "100%", height: "100%", @@ -397,7 +399,7 @@ To load these dependencies, reveal.js requires [head.js](http://headjs.com/) *(a ### 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 Reveal.addEventListener( 'ready', function( event ) { @@ -417,9 +419,10 @@ Reveal.configure({ 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
@@ -429,14 +432,13 @@ You can also override the slide duration for individual slides and fragments by
``` -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. +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. ### 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 Reveal.configure({ @@ -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. - ### 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. -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
@@ -472,10 +473,9 @@ To enable lazy loading all you need to do is change your "src" attributes to "da
``` - ### 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 // Navigation @@ -514,11 +514,11 @@ Reveal.getScale(); Reveal.getPreviousSlide(); Reveal.getCurrentSlide(); -Reveal.getIndices(); // { h: 0, v: 0 } } -Reveal.getPastSlideCount(); +Reveal.getIndices(); // { h: 0, v: 0, f: 0 } +Reveal.getSlidePastCount(); Reveal.getProgress(); // (0 == first slide, 1 == last slide) 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 Reveal.getSlideNotes(); @@ -533,7 +533,7 @@ Reveal.isAutoSliding(); ### 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. @@ -562,7 +562,7 @@ Reveal.setState( state ); ### Slide States -If you set ``data-state="somestate"`` on a slide ``
``, "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 `
`, "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: @@ -574,10 +574,12 @@ Reveal.addEventListener( 'somestate', function() { ### 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 ```
``` 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 `
` elements. Four different types of backgrounds are supported: color, image, video and iframe. #### 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

Color

@@ -585,6 +587,7 @@ All CSS color formats are supported, like rgba() or hsl(). ``` #### Image Backgrounds + By default, background images are resized to cover the full page. Available options: | Attribute | Default | Description | @@ -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-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. | + ```html

Image

@@ -603,6 +607,7 @@ By default, background images are resized to cover the full page. Available opti ``` #### Video Backgrounds + Automatically plays a full size video behind the slide. | Attribute | Default | Description | @@ -619,7 +624,9 @@ Automatically plays a full size video behind the slide. ``` #### 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. + ```html

Iframe

@@ -627,12 +634,13 @@ Embeds a web page as a slide background that covers 100% of the reveal.js width ``` #### 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 -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 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¶llaxBackgroundSize=2100px%20900px). - - ### 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
@@ -689,17 +696,16 @@ You can also use different in and out transitions for the same slide:
``` - ### 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 (```
```): +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 (`
`): ```html Link Link ``` -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 @@ -710,9 +716,9 @@ You can also add relative navigation links, similar to the built in reveal.js co ``` - ### 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: @@ -740,7 +746,7 @@ Multiple fragments can be applied to the same element sequentially by wrapping i
``` -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
@@ -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)). +```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 `` to call out a line of code, add the `data-noescape` attribute to the `` element. ```html @@ -784,7 +799,8 @@ Below is an example with clojure code that will be syntax highlighted. When the ``` ### 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 // Shows the slide number using default formatting @@ -802,13 +818,11 @@ Reveal.configure({ slideNumber: 'c/t' }); // "speaker": only show slide numbers on speaker notes view // "print": only show slide numbers when printing to PDF Reveal.configure({ showSlideNumber: 'speaker' }); - ``` - ### 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: ```javascript @@ -819,12 +833,12 @@ Reveal.addEventListener( 'overviewhidden', function( event ) { /* ... */ } ); Reveal.toggleOverview(); ``` - ### 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 + Add `data-autoplay` to your media element if you want it to automatically start playing when the slide is shown: ```html @@ -835,14 +849,13 @@ If you want to enable or disable autoplay globally, for all embedded media, you Note that embedded HTML5 `