1
0
mirror of https://github.com/hakimel/reveal.js.git synced 2025-08-30 17:59:59 +02:00

tweak plugin initialization to enable multi-instance plugins

This commit is contained in:
Hakim El Hattab
2020-04-17 14:10:56 +02:00
parent 7e72b10fa5
commit e58502b3fb
20 changed files with 128 additions and 110 deletions

View File

@@ -173,17 +173,33 @@ If you want to run multiple presentations side-by-side on the same page you can
```html
<div class="reveal deck-1">...</div>
<div class="reveal deck-2">...</div>
<script type="module">
import Deck from 'js/reveal.js';
let deck1 = new Deck( document.querySelector( 'deck-1' ), { embedded: true } );
let deck2 = new Deck( document.querySelector( 'deck-2' ), { embedded: true } );
<script src="dist/reveal.es5.js"></script>
<script>
let deck1 = new Reveal( document.querySelector( 'deck-1' ), { embedded: true } );
let deck2 = new Reveal( document.querySelector( 'deck-2' ), { embedded: true } );
deck1.initialize();
deck2.initialize();
</script>
```
### ES Module
We provide two JavaScript bundles; `/dist/reveal.es5.js` with support for legacy browers and `/dist/reveal.js` which targets modern browsers with ES6 support.
Here's how to import and initialize the ES module version of reveal.js, including the Markdown plugin:
```html
<script type="module">
import Reveal from '/dist/reveal.js';
import markdown from '/plugin/markdown/markdown.js';
Reveal.initialize({
keyboard: true,
plugins: [ markdown() ]
});
</script>
```
### Configuration
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.