Skip to content

Commit

Permalink
Merge pull request #10 from pganssle/options
Browse files Browse the repository at this point in the history
Fix rendering of reveal options
  • Loading branch information
dploeger authored Jul 10, 2018
2 parents fa2ad92 + 9ced54d commit 515cb43
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 5 deletions.
34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ You can configure almost any reveal.js setting using the _config.yml-settings fi
* reveal_theme_path: The path to the reveal.js-theme (can be changed for custom themes) [reveal.js/css/theme/]
* reveal_notes_server: Wether to support the speaker notes server [false (only local speaker notes)]
* reveal_options: Additional reveal.js [options][]

* reveal_dependencies: Additional reveal.js [dependencies][]
* reveal_path: Path to the reveal.js-installation [reveal.js]

Expand All @@ -64,6 +65,39 @@ You can also further customize the presentation:
* extra_css: Additional CSS files added after the reveal theme []
* highlight_style_sheet: CSS theme for highlight.js [reveal.js/lib/css/zenburn.css]

### Specifying reveal options and dependencies

`reveal_options` can be either a list of strings specifying the Javascript options, e.g.:

```yaml
reveal_options:
- 'width: "960px"'
- 'height: "720px"'
```
or, as a convenience, it can be a mapping of options to their values:
```yaml
reveal_options:
width: 960px
height: 720px
```
Note that if a mapping is passed, the values will be inserted into the
final javascript as quoted strings. If this is unacceptable (for example,
if you want to pass a boolean parameter that takes `true` or `false`),
specify a list of strings.

`reveal_dependencies` takes a list of strings representing the javascript
to specify a dependency [as you would in reveal.js](https://github.com/hakimel/reveal.js/#dependencies),
for example:

```yaml
reveal_dependencies:
# Speaker notes
- "{ src: 'path/to/plugin.js', async: true },"
```

## Custom reveal.js-themes

If you want to use your custom reveal.js-theme, we recommend adding a directory "theme", putting the file(s)
Expand Down
15 changes: 10 additions & 5 deletions _layouts/reveal.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@

<meta name="description" content="A framework for easily creating beautiful presentations using HTML">
<meta name="author" content="Hakim El Hattab">

<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />

<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
Expand Down Expand Up @@ -69,9 +68,15 @@
transition: '{{ site.reveal_transition }}', // default/cube/page/concave/zoom/linear/fade/none

{% if site.reveal_options %}

{{ site.reveal_options | append:',' }}

{% if site.reveal_options.first.first %}
// Reveal options generated from mapping
{% for option in site.reveal_options %}
{{ option[0] }}: "{{ option[1] }}",
{% endfor %}
{% else %}
// Reveal options generated from a list of strings
{{ site.reveal_options | append:',' }}
{% endif %}
{% endif %}

// Optional libraries used to extend on reveal.js
Expand Down

0 comments on commit 515cb43

Please sign in to comment.