first commit

This commit is contained in:
2025-06-25 15:54:11 +02:00
commit 23e651d13a
465 changed files with 30834 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
+++
title = "reveal-hugo"
description = "A Hugo theme for creating Reveal.js presentations"
outputs = ["Reveal"]
[reveal_hugo]
custom_theme = "reveal-hugo/themes/robot-lung.css"
margin = 0.2
highlight_theme = "color-brewer"
transition = "slide"
transition_speed = "fast"
[reveal_hugo.templates.hotpink]
class = "hotpink"
background = "#FF4081"
+++
# 📽️
# reveal-hugo
A Hugo theme for creating Reveal.js presentations.
~ made by [@dzello](https://joshed.io/) ~

View File

@@ -0,0 +1,16 @@
+++
+++
If more markdown files are present in the bundle, their contents will be added to the presentation.
---
Specify `weight` in the frontmatter if it's necessary to order them.
---
If you don't want them to be included, specify `layout = "list"` in the front matter instead of `layout = "bundle"`.
---
## THE END

View File

@@ -0,0 +1,30 @@
+++
title = "Bundle example presentation"
outputs = ["Reveal"]
layout = "bundle"
[reveal_hugo]
theme = "night"
margin = 0.2
+++
# Page Bundles
---
[Hugo page bundles](https://gohugo.io/content-management/page-bundles/) are a useful way to organize content.
---
To create a reveal-hugo presentation from the `index.md` file of a leaf page bundle, you need to specify the layout manually.
```toml
layout = "bundle"
```
---
Why? By default, reveal-hugo doesn't create pages for single template types (foo.md), only for list template types (_index.md).
---
This technique can also be used to output an HTML file for any section of a presentation, should you need to.

View File

@@ -0,0 +1,74 @@
+++
title = "Custom theme example presentation"
outputs = ["Reveal"]
[reveal_hugo]
custom_theme = "custom-theme.scss"
custom_theme_compile = true
+++
## 🖌
## Custom Themes
*with Hugo Pipes*
---
This presentation uses a custom Reveal.js theme written in SCSS that is compiled by Hugo, using [Hugo pipes](https://gohugo.io/hugo-pipes/).
---
Hugo pipes compiles the source code of the theme, located in `assets/custom-theme.scss`, into CSS.
---
## 😄
No separate build process is required, which means you can iterate on your theme and your content at the same time.
---
To set a custom theme and use Hugo to compile it:
```toml
[reveal_hugo]
custom_theme = "custom-theme.scss"
custom_theme_compile = true
```
`custom-theme.scss` must live in the `assets` folder.
---
To pass compilation options, use the `custom_theme_options` param:
```toml
[reveal_hugo.custom_theme_options]
targetPath = "css/custom-theme.css"
enableSourceMap = true
```
See all the [available options](https://gohugo.io/hugo-pipes/scss-sass/#options).
---
Note: to use a custom theme that doesn't need compilation, put it in the `static` directory and do not set the `custom_theme_compile` parameter. It will be served to the browser directly.
---
Write a custom Reveal.js theme in four steps:
```text
1. Import `mixins` and `settings` from the templates directory
2. Override variables and functions for colors, fonts and sizes
3. Import `theme` from the templates directory
4. Add any additional selectors to override the built CSS
```
---
See the [Reveal.js theme docs](https://github.com/hakimel/reveal.js/blob/master/css/theme/README.md) to learn what overrides are possible.
---
See `assets/custom-theme.scss` or any file in `assets/reveal-js/dist/theme/source` for an example.

View File

@@ -0,0 +1,53 @@
+++
title = "Extend layout with configuration"
outputs = ["Reveal"]
[reveal_hugo]
theme = "night"
margin = 0.2
custom_css = "css/custom.css"
custom_js = "js/custom.js"
+++
### Extending an existing layout
If you are using an existing theme and you want to a specific CSS class or add a dynamic function using javascript. It is possible to extend existing layout.
---
### Extending CSS
You can use `partials` or you can specify `custom_css` in your configuration :
```toml
[reveal_hugo]
custom_css = "css/custom.css"
```
<small>
The `custom.css` can be present in `static/css/custom.css`
</small>
---
### Extending with javascript
Same as CSS you can extend your presentation with javascript using `partials` or with `custom_js` in your configuration:
```toml
[reveal_hugo]
custom_js = "js/custom.js"
```
<small>
The `custom.js` can be present in `static/js/custom.js`
</small>
---
{{< slide class="custom" id="customjs" >}}
## Extend layout example
Here the slide has an additional css class `custom` using `slide` *shortcode*. This class is hosted in a custom CSS.
If you click on this text background-color will using a custom javascript file.

View File

@@ -0,0 +1,160 @@
+++
title = "Reveal.js highlighting example"
outputs = ["Reveal"]
[reveal_hugo]
theme = "white"
highlight_theme = "vs"
+++
## Multiline highlighting with Highlight.js
---
This presentation shows the use of the [new highlighting features](https://revealjs.com/code/) which were introduced with Reveal.js [v3.9.0](https://github.com/hakimel/reveal.js/releases/tag/3.9.0).
---
## Prerequisite
Disable `codeFences` in to your `config.toml` to prevent Hugo's built-in highlighting for code inside of `---` fences.
{{< highlight toml "style=github" >}}
[markup.highlight]
codeFences = false
{{< /highlight >}}
---
## Theme
Specify a theme for Highlight.js in `config.toml`
{{< highlight toml "style=github" >}}
[params.reveal_hugo]
highlight_theme = "github"
{{< /highlight >}}
---
...or in the `_index.md` front matter
{{< highlight toml "style=github" >}}
[reveal_hugo]
highlight_theme = "github"
{{< /highlight >}}
---
## Usage
The line highlighting is configured by adding `{}` immediately after the language selection of the markdown code block.
{{< highlight md >}}
```foo{}
```
{{< /highlight >}}
---
## Just line numbers
`{}`
{{< highlight md >}}
```go{}
package main
import "fmt"
func main() {
fmt.Println("Hello world!")
}
```
{{< /highlight >}}
```go{}
package main
import "fmt"
func main() {
fmt.Println("Hello world!")
}
```
---
## Highlight specific lines
`{<line numbers separated by comma>}`
{{< highlight md >}}
```go{1,3-5}
package main
import "fmt"
func main() {
fmt.Println("Hello world!")
}
```
{{< /highlight >}}
```go{1,3-5}
package main
import "fmt"
func main() {
fmt.Println("Hello world!")
}
```
---
## Multi step highlight
`{<line numbers separated by pipe>}`
{{< highlight md >}}
```go{1|2|3-5}
package main
import "fmt"
func main() {
fmt.Println("Hello world!")
}
```
{{< /highlight >}}
```go{1|2|3-5}
package main
import "fmt"
func main() {
fmt.Println("Hello world!")
}
```
---
## Hiding the line numbers
There is no Reveal.js parameter to use line highlighting *without* line numbers.
However it can be achieved by adding the some [custom CSS](https://github.com/joshed-io/reveal-hugo#adding-html-to-the-layout).
{{< highlight html "style=github" >}}
<style>
.hljs-ln-numbers {
display: none;
}
</style>
{{< /highlight >}}
---
💡 Put the custom CSS in either of these partials:
```text
# for all presentations
layouts/partials/reveal-hugo/body.html
```
```text
# for one presentation
layouts/partials/{presentation-name}/reveal-hugo/body.html
```
---
Thanks!

View File

@@ -0,0 +1,171 @@
+++
weight = 21
+++
{{< slide id=configuration >}}
# Configuration
Place configuration values in `config.toml` or a presentation's front matter (`_index.md`).
---
## Reveal.js themes
Themes control the look and feel of your presentation. Set the `theme` param to any [valid Reveal.js theme](https://revealjs.com/themes/).
```toml
[params.reveal_hugo]
theme = "moon"
```
---
## Use a custom theme
To use a custom Reveal.js theme, place the CSS file in the `static` directory and set the `custom_theme` param.
```toml
[params.reveal_hugo]
custom_theme = "reveal-hugo/themes/robot-lung.css"
```
---
### Use a custom theme (advanced)
To use Hugo pipes to build a custom Reveal.js theme, place the source file (SCSS / PostCSS) in the `assets` directory and set the `custom_theme_compile` param.
```toml
[params.reveal_hugo]
custom_theme = "reveal-hugo/themes/custom-theme.scss"
custom_theme_compile = true
```
<small>
💡 See the [custom theme example presentation](/custom-theme-example/) for more details.
</small>
---
## Bundled themes
reveal-hugo comes with 2 extra Reveal.js themes:
- [robot-lung](https://github.com/joshed-io/revealjs-themes#robot-lung) (this one)
- [sunblind](https://github.com/joshed-io/revealjs-themes#sunblind)
<br>
<small>
They live in the `static/reveal-hugo/themes` folder and also [on Github](https://github.com/joshed-io/revealjs-themes).
</small>
---
## Reveal.js params
Set **snakecase** versions of Reveal.js params, which will be camelized and passed to `Reveal.initialize`.
```toml
[params.reveal_hugo]
history = true
slide_number = true
transition = 'zoom'
transition_speed = 'fast'
```
[Full list of params](https://github.com/hakimel/reveal.js/#configuration)
---
## highlight.js themes
To change the syntax highlighting theme, set the `highlight_theme`
to a valid [highlight.js theme name](https://highlightjs.org/static/demo/).
```toml
[params.reveal_hugo]
highlight_theme = "zenburn"
```
---
## Extending the layout
Use partials to add HTML to the page for one or all presentations at a time.
<small>
💡 This is the recommended way to add script and style tags to customize your presentations.
</small>
---
Here is where to put partials for different presentations and places in the DOM.
<br><br>
| Presentation | Before &lt;/head&gt; | Before &lt;/body&gt; |
|--------------|---------------------------------|---------------------------------|
| All | reveal-hugo/head.html | reveal-hugo/body.html |
| Root | home/reveal-hugo/head.html | home/reveal-hugo/body.html |
| Section | {section}/reveal-hugo/head.html | {section}/reveal-hugo/body.html |
&nbsp;
<small>
💡 You can also create an `end.html` to put content before the end of the `.reveal` div tag.
</small>
---
## Custom CSS Example
In `home/reveal-hugo/head.html`:
```html
<style>
.reveal section h1 {
color: blue;
}
</style>
```
---
## Custom JS Example
In `home/reveal-hugo/body.html`:
```html
<script type="text/javascript">
Reveal.on('slidechanged', function(event) {
console.log("🎞️ Slide is now " + event.indexh);
});
</script>
```
---
### Extending the layout
#### (alternative)
You can declare a custom CSS or javascript in your configuration.
```toml
[reveal_hugo]
custom_css = "css/custom.css"
custom_js = "js/custom.js"
```
<small>
These files can be located in `static/css`, `static/js` folder
💡 See the [extending layout example](/extending-layout-example/#) for more details.
</small>

View File

@@ -0,0 +1,28 @@
+++
weight = 10
+++
{{< slide id=included >}}
## What's included?
- All Reveal.js HTML, CSS and JS (v5.1.0)
- All out-of-the-box Reveal.js themes
- Two custom Reveal.js themes (including this one)
<br>
<br>
[see the code on github](https://github.com/joshed-io/reveal-hugo)
---
{{< slide id=features >}}
## Features
- Write slides in Markdown in one or more files
- Shortcodes for fragments, sections, slides & more
- All Reveal.js parameters can be customized
- Any Hugo section can be output as a presentation
- Supports math code blocks
- Supports mermaid code blocks
- Supports offline development or using a CDN

View File

@@ -0,0 +1,43 @@
+++
weight = 42
+++
# Resources
---
## Code and docs
- [reveal-hugo Github README](https://github.com/joshed-io/reveal-hugo)
- [Content for this presentation](https://github.com/joshed-io/reveal-hugo/tree/master/exampleSite)
---
## External resources
- [Reveal.js](https://revealjs.com/)
- [Hugo docs](https://gohugo.io/)
- [Hugo output format docs](https://gohugo.io/templates/output-formats/)
---
## Designed to...
- Deploy to [Netlify](https://netlify.com/)
- Edit with [Forestry](https://forestry.io/)
---
# 🙏
Contribute by opening issues and pull requests.
---
# Thanks!
---
# ↩️
#### [Start over](#)

View File

@@ -0,0 +1,41 @@
+++
weight = 30
+++
## Fragment
The `fragment` shortcode makes content appear incrementally.
```
{{%/* fragment */%}} One {{%/* /fragment */%}}
{{%/* fragment */%}} Two {{%/* /fragment */%}}
{{%/* fragment */%}} Three {{%/* /fragment */%}}
```
{{% fragment %}} One {{% /fragment %}}
{{% fragment %}} Two {{% /fragment %}}
{{% fragment %}} Three {{% /fragment %}}
---
## Frag
The `frag` shortcode is more terse than `fragment`. It accepts a `c` attribute.
```
{{</* frag c="One" */>}}
{{</* frag c="Two" */>}}
{{</* frag c="Three" */>}}
```
{{< frag c="One" >}}
{{< frag c="Two" >}}
{{< frag c="Three" >}}
---
Both `fragment` and `frag` accept two additional parameters:
- `class`: sets the class of the wrapping `span` element
- `index`: controls the order in which sections will appear

View File

@@ -0,0 +1,11 @@
+++
weight = 29
+++
# Shortcodes
---
Hugo's shortcodes are similar to functions or templates that extend what you can do with Markdown.
[Shortcode documentation](https://gohugo.io/content-management/shortcodes/)

View File

@@ -0,0 +1,38 @@
+++
weight = 36
+++
{{< markdown >}}
## Markdown
Reveal.js has its own [markdown processor](https://github.com/hakimel/reveal.js#markdown). To use that instead of Hugo, surround a slide with the markdown shortcode.
```markdown
{{</* markdown */>}}
# Hello world!
{{</* /markdown */>}}
```
<br>
<small>
💡 Make sure to use the `{{</* */>}}` shortcode syntax to avoid rendering by Hugo.
</small>
---
<!-- .slide: data-background="#FF4081" -->
Reveal.js markdown uses HTML comments to change slide properties, like background color.
```markdown
{{</* markdown */>}}
<!-- .slide: data-background="#FF4081" -->
# I'm a colorful slide
{{</* /markdown */>}}
```
{{< /markdown >}}

View File

@@ -0,0 +1,34 @@
+++
weight = 31
+++
{{< slide id=math-shortcode >}}
### Mathematical equations
Use the `math` shortcode if you need to enable reveal-js highlighting module
(`codeFences = false`).
```code
{{</* math */>}}
\tag*{(1)} \lim\limits_{x \to \infty} \exp(-x) = 0
{{</* /math */>}}
```
<small>
displays as:
</small>
{{< math >}}
\tag*{(1)} \lim\limits_{x \to \infty} \exp(-x) = 0
{{< /math >}}
For inline equations, use a self closed `math` shortcode:
```code
Albert Einstein's famous formula: {{</* math "E=mc^2" /*/>}}
```
<small>
is rendered to:
</small>
Albert Einstein's famous formula: {{< math "E=mc^2" />}}

View File

@@ -0,0 +1,27 @@
+++
weight = 32
+++
{{< slide id=mermaid-shortcode >}}
# Mermaid diagrams
Use the `mermaid` shortcode if you need to enable reveal-js highlighting module
(`codeFences = false`). Otherwise, when `codeFences = true`, ` ```mermaid ``` ` codeblocks
are also supported. [More info](hugo-hl-example/#/5).
```code
{{</* mermaid */>}}
graph LR
A --> B
B --> C
{{</* /mermaid */>}}
```
results in:
{{< mermaid >}}
graph LR
A --> B
B --> C
{{< /mermaid >}}

View File

@@ -0,0 +1,49 @@
+++
weight = 38
+++
## Notes
Add speaker notes (with markdown) to your presentation with the `note` shortcode. Type 's' to see this slide's speaker notes.
```markdown
---
{{%/* note */%}}
- You found the **speaker notes**!
{{%/* /note */%}}
---
```
{{% note %}}
- You found the **speaker notes**!
{{% /note %}}
---
{{< slide notes="You found the notes!" >}}
## Notes
You can also add notes with the `slide` shortcode and `notes` attribute:
```markdown
---
{{%/* slide notes="You found the notes!" */%}}
---
```
---
<section data-noprocess>
<h2>Write slides in HTML</h2>
<p>Use a <code>section</code> tag with a <code>data-noprocess</code> attribute to avoid any processing by reveal-hugo.</p>
<pre>
&lt;section data-noprocess&gt;
&lt;h1&gt;Hello world!&lt;/h1&gt;
&lt;/section&gt;</pre>
<small>💡 This is useful if you can't get Markdown to output exactly what you want.</small>
</section>

View File

@@ -0,0 +1,44 @@
+++
weight = 33
+++
{{% section %}}
## Section
The `section` shortcode groups slides into a **vertical display**.
<br>
<small>
use the down arrow or swipe down to continue
</small>
<br>
<a href="#" class="navigate-down">🔽</a>
---
Put the shortcode around the slides you want to group together.
```markdown
{{%/* section */%}}
## Section slide 1
---
## Section slide 2
{{%/* /section */%}}
```
Keep going down.
---
## That's it!
Use the right arrow or swipe right to continue.
{{% /section %}}

View File

@@ -0,0 +1,250 @@
+++
weight = 34
+++
## Slide
Use this shortcode when you need to customize slide attributes like id, class, background color and transition.
---
{{< slide class="hello" >}}
## Slide
Add the shortcode above the slide's content, below the `---`.
```markdown
---
{{</* slide class="hello" */>}}
## Hello, world!
---
```
---
{{< slide transition="zoom" transition-speed="fast" >}}
## Custom slide 1
<small>Did you notice? This slide has a fast zoom transition.</small>
```markdown
---
{{</* slide transition="zoom" transition-speed="fast" */>}}
## Custom slide 1
---
```
---
{{< slide background-color="#FF4081" >}}
## Custom slide 2
<small>This slide has a different background color.</small>
```markdown
---
{{</* slide background-color="#FF4081" */>}}
## Custom slide 2
---
```
---
{{< slide background-image="/images/alex-litvin-790876-unsplash.jpg" background-color="#000000" >}}
## Custom slide 3
<small>This slide has a background image.</small>
```markdown
---
{{</* slide background-image="/images/alex-litvin-790876-unsplash.jpg" */>}}
---
```
<small>(credit <a href="https://unsplash.com/@alexlitvin">Alex Litvin</a>)</small>
---
{{< slide id="custom-slide" >}}
💡 Tip: Setting a slide's `id` attribute makes it easy to link to from other parts of the presentation.
<br><br>
```markdown
---
{{</* slide id="custom-slide" */>}}
## Custom slide
---
```
---
```markdown
[Try the link](#custom-slide)
```
<br>
[Try the link](#custom-slide)
---
Slide attribute possibilities from the [Reveal.js docs](https://github.com/hakimel/reveal.js):
- `autoslide`
- `state`
- `background`
- `background-color`
- `background-image`
- `background-size`
- `background-position`
- `background-repeat`
---
- `background-video`
- `background-video-loop`
- `background-video-muted`
- `background-interactive`
- `background-iframe`
- `background-transition`
- `transition` (can have different in and out transitions)
- `transition-speed`
- `notes` (can also use the note shortcode)
- `timing`
---
{{% section %}}
## Slide templates
Store sets of common slide attributes in front matter variables and apply them to slides with the template attribute.
<br>
<small>
navigate down to learn more
</small>
<br>
<a href="#" class="navigate-down">🔽</a>
---
Create templates in config.toml, _index.md or the current page's front matter. Put them under the **templates** key with a meaningful name:
```toml
[reveal_hugo.templates.hotpink]
class = "hotpink"
background = "#FF4081"
```
---
{{< slide template="hotpink" >}}
Apply the template using the **template** attribute of the slide shortcode:
```markdown
{{</* slide template="hotpink" */>}}
# I'm a hot pink slide!
```
---
If a template exists in multiple configurations, it's properties will be merged. If a property is declared multiple times, the order of precedence is:
- page
- section (_index.md)
- site (config.toml)
{{% /section %}}
---
{{% section %}}
{{< slide content="home.reusable" >}}
---
{{< slide content="common.nested.reusable" >}}
{{% /section %}}
---
{{% section %}}
## Slide-specific CSS
Add more variety to your presentation by applying slide-specific CSS.
<br>
<small>
navigate down to learn more
</small>
<br>
<a href="#" class="navigate-down">🔽</a>
---
First, use the `slide` shortcode to give the slide a class:
```markdown
---
{{</* slide class="side-by-side" */>}}
# 📈
# 📊
---
```
---
Next, use a layout extension partial like `reveal-hugo/head.html` to add CSS selectors:
```html
<style>
.reveal section.side-by-side h1 {
position: absolute;
}
.reveal section.side-by-side h1:first-of-type {
left: 25%;
}
.reveal section.side-by-side h1:nth-of-type(2) {
right: 25%;
}
</style>
```
---
{{< slide class="side-by-side" >}}
# 📈
# 📊
{{% /section %}}

View File

@@ -0,0 +1,178 @@
+++
weight = 20
+++
{{< slide id=usage >}}
# Usage
---
{{< slide id=prerequisite >}}
## Prerequisite
First, add this to your `config.toml`:
```toml
[outputFormats.Reveal]
baseName = "index"
mediaType = "text/html"
isHTML = true
```
---
### Presentation at site root
Create `content/_index.md`:
```markdown
+++
outputs = ["Reveal"]
+++
# Slide 1
Hello world!
```
---
{{< slide id=adding-slides >}}
### Add slides
Separate them by `---` surrounded by blank lines:
```
# Slide 1
Hello world!
---
# Slide 2
Hello program!
```
---
{{< slide id=math-equations >}}
### Cool equations
For equations, you can use a [`math`](https://docs.gitlab.com/ee/user/markdown.html#math) code block:
````code
```math
\tag*{(1)} \lim\limits_{x \to \infty} \exp(-x) = 0
```
````
<small>
renders to:
</small>
{{< math >}}
\tag*{(1)} \lim\limits_{x \to \infty} \exp(-x) = 0
{{< /math >}}
Inline equations (e. g. $E=mc^2$) are wrapped in single $:
```code
Albert Einstein's famous formula: $E=mc^2$
```
<small>💡 Note: When using inline math only (no math code block present), you have to set `math=true` in the frontmatter of your slide page.</small>
<small>💡 Note: for code blocks support (` ```math ...``` `), hugo highlighting must be on (`codeFences = true` in `config.toml`). If you want to set `codeFences = false`, use the `math` [shortcode](#/math-shortcode).</small>
---
{{< slide id=mermaid-diagrams >}}
### Mermaid
Slides can contain [mermaid](https://mermaid-js.github.io/mermaid/#/) diagrams:
````code
```mermaid
graph LR
A --> B
B --> C
```
````
Or (see [mermaid shortcode](#/mermaid-shortcode))
```code
{{</* mermaid */>}}
graph LR
A --> B
B --> C
{{</* /mermaid */>}}
```
results in:
{{< mermaid >}}
graph LR
A --> B
B --> C
{{< /mermaid >}}
<small>💡 Note: for code blocks support (` ```mermaid ...``` `), hugo highlighting must be on (codeFences = true in config.toml)</small>
---
### Add slides with other files
Add slides to `content/home/*.md`
```markdown
+++
weight = 10
+++
# Slide 3
---
# Slide 4
```
<small>💡 Tip: Use `weight` to specify the order that files should be considered.</small>
---
### Presentation at '/{section}/'
Add slides to `content/{section}/_index.md`:
```markdown
+++
outputs = ["Reveal"]
+++
# Slide 1
---
# Slide 2
```
---
Add slides from other files in `content/{section}/*.md`
```markdown
+++
weight = 10
+++
# Slide 3
---
# Slide 4
```
<small>💡 Tip: Use `weight` to specify the order that files should be considered.</small>

View File

@@ -0,0 +1,119 @@
+++
title = "Hugo highlighting example"
outputs = ["Reveal"]
[reveal_hugo]
theme = "simple"
+++
## Hugo Highlighter Presentation
This is an example of a presentation using Hugo's compile-time syntax highlighter.
---
Reveal.js uses Javascript for syntax highlighting (via Highlight.js). This might slow the presentation down if many slides contain code.
---
Hugo has a built-in [compile-time highlighter](https://gohugo.io/content-management/syntax-highlighting/), and it's lightning fast too!
---
You can enable it using the `highlight` shortcode.
{{< highlight go >}}
{{</* highlight go */>}}
package main
import "fmt"
func main() {
fmt.Println("Hello world!")
}
{{</* /highlight */>}}
{{< /highlight >}}
---
Several options are supported, check [Hugo's documentation](https://gohugo.io/content-management/syntax-highlighting/).
{{< highlight go "style=github,linenos=inline,hl_lines=8" >}}
{{</* highlight go "style=github,linenos=inline,hl_lines=6" */>}}
package main
import "fmt"
func main() {
fmt.Println("Hello world!")
}
{{</* /highlight */>}}
{{< / highlight >}}
---
You can also use Hugo's highlighter in markdown code fences,
by putting this in `config.toml`:
{{< highlight toml "style=github" >}}
# use Hugo's hl in markdown (with or without a language tag)
[markup.highlight]
codeFences = true
style = "github"
{{< /highlight >}}
(This can only be enabled globally for all presentations.)
---
- Highlight.js is automatically disabled in code blocks highlighted by Hugo.
- The two highlighters can be even mixed.
{{< highlight go >}}
package main
import "fmt"
func main() {
fmt.Println("Hello world!")
}
{{< / highlight >}}
```go
package main
import "fmt"
func main() {
fmt.Println("Hello world!")
}
```
---
If you don't need highlight.js at all, you can prevent it from loading.
{{< highlight toml "style=github" >}}
# This works both in config.toml and a presentation's front
# matter. Default plugins include highlight.js, so disable them
# and load those that we want manually.
[params.reveal_hugo]
load_default_plugins = false
[[params.reveal_hugo.plugins]]
name = "RevealZoom"
source = "reveal-js/plugin/zoom-js/zoom.js"
[[params.reveal_hugo.plugins]]
name = "RevealNotes"
source = "reveal-js/plugin/notes/notes.js"
{{< /highlight >}}

View File

@@ -0,0 +1,90 @@
+++
title = "Logo presentation example"
outputs = ["Reveal"]
[logo]
src = "github-logo.png"
[reveal_hugo]
custom_theme = "reveal-hugo/themes/robot-lung.css"
margin = 0.2
+++
## logo-example
This presentation shows how to add a logo to each slide, like the GitHub one you see above.
You can generalize the concept to add any additional markup to your presentations.
---
[See the code for this presentation](https://github.com/joshed-io/reveal-hugo/blob/master/exampleSite/content/logo-example)
---
For a basic setup, in the front matter, add an image to the presentation's directory.
Then, add a logo section in the front matter:
```toml
[logo]
src = "github-logo.png"
```
The front matter should end up looking like this:
```toml
+++
title = "Logo presentation example"
outputs = ["Reveal"]
[logo]
src = "github-logo.png"
+++
```
---
If the logo placement doesn't quite match your needs, you may customize it with the following parameters:
```toml
[logo]
src = "github-logo.png" # Location of the file displayed.
alt = "" # Alt text.
width = "15%" # Size of the file.
diag = "1%" # How far from the top right should the file be.
top = "1%" # Overrides diag.
right = "1%" # Overrides diag.
```
- Instead of absolute (`250px`), relative measurements (`12.5%`) should be used. They work better with different screen sizes.
- By default, null (`""`) is used as alt text for logos, as otherwise the alt text would unnecessarily get read by screen readers.
---
💡 Tip: to make the logo settings present on every presentation, add the settings to your site's configuration file `config.toml` under `[params.logo]`:
```toml
[params.logo]
src = "/img/logo.png"
```
Note that now, the path to the logo file shall be absolute, and should be stored in `static/img/logo.png` instead.
---
Depending on the theme you're using, your styles will be different. <br>You may also prefer to put your CSS in an external file or your Reveal.js theme.
For per-presentation override, you may add custom CSS with the ID `#logo` to:
```text
layouts/partials/{section}/reveal-hugo/body.html
```
Substitute `{section}` for `home` if you are adding a logo to the presentation at `content/_index.md`. Otherwise, substitute the name of the Hugo section where your presentation lives.
For a site-wide override, use:
```text
layouts/partials/{section}/reveal-hugo/body.html
```
---
# 🤗
That's it.
Happy Hugo-ing!

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

View File

@@ -0,0 +1,90 @@
+++
title = "plugin-example"
description = "Shows how a Reveal.js plugin can be added and used"
outputs = ["Reveal"]
[reveal_hugo]
theme = "night"
margin = 0.2
# Deprecated array form. Css needs to be added in
# a head layout override
# plugins = ["plugin/gallery/gallery.plugin.js"]
# New plugin object form; reveal-hugo
# will load your css for you
[[reveal_hugo.plugins]]
name = "Gallery"
source = "plugin/gallery/gallery.plugin.js"
css = "plugin/gallery/gallery.css"
+++
# plugin-example
---
This presentation demonstrates how a Reveal.js plugin can be added.
---
The plugin is called [revealjs-simple-gallery](https://github.com/marcins/revealjs-simple-gallery).
---
It can make any slide an image gallery. Here are a few examples.
---
<ul class="gallery">
<li><img src="sample1.jpg" alt="Default settings (Photo by Oscar Fernandez Alonso on Flickr)"></li>
<li><img src="sample2.jpg" alt="Default settings (Photo by bullcitydogs on Flickr)"></li>
<li><img src="sample3.jpg" alt="Default settings (Photo by Lance McCord on Flickr)"></li>
</ul>
---
<ul class="gallery" data-iterations="0" data-interval="1">
<li><img src="sample1.jpg" alt="Infinite iterations, fast transition (Photo by Oscar Fernandez Alonso on Flickr)"></li>
<li><img src="sample2.jpg" alt="Infinite iterations, fast transition (Photo by bullcitydogs on Flickr)"></li>
<li><img src="sample3.jpg" alt="Infinite iterations, fast transition (Photo by Lance McCord on Flickr)"></li>
</ul>
---
<ul class="gallery" data-iterations="2" data-interval="2" data-mode="full-screen">
<li><img src="sample1.jpg" alt="Full screen, two iterations, slow transition (Photo by Oscar Fernandez Alonso on Flickr)"></li>
<li><img src="sample2.jpg" alt="Full screen, two iterations, slow transition (Photo by bullcitydogs on Flickr)"></li>
<li><img src="sample3.jpg" alt="Full screen, two iterations, slow transition (Photo by Lance McCord on Flickr)"></li>
</ul>
---
See the [revealjs-simple-gallery GitHub repo](https://github.com/marcins/revealjs-simple-gallery) to learn about more customization options.
---
These are the steps to use this plugin for this reveal-hugo presentation.
---
### 1
Copy the plugin CSS and JavaScript into the static directory
---
### 2
Add the JavaScript (and optionally css) file path to the `plugins` field in the
front matter
```toml
[[reveal_hugo.plugins]]
# name must match the name by which the plugin is exported
name = "Gallery"
source = "plugin/gallery/gallery.plugin.js"
css = "plugin/gallery/gallery.css"
```
---
## THE END

Binary file not shown.

After

Width:  |  Height:  |  Size: 316 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 182 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 KiB

View File

@@ -0,0 +1,19 @@
+++
title = "Section presentation example"
outputs = ["Reveal"]
[reveal_hugo]
theme = "night"
margin = 0.2
+++
# Section Presentation
This is an example of a section presentation.
---
Section presentations are completely separate from the root presentation and each other.
---
Additional content files can be placed in the section and will be added to the presentation in the order of their weight.

View File

@@ -0,0 +1,8 @@
+++
weight = 10
+++
# Including...
Content from files like this one.

View File

@@ -0,0 +1,45 @@
+++
title = "Template presentation"
outputs = ["Reveal"]
[reveal_hugo]
theme = "night"
margin = 0.2
[reveal_hugo.templates.blue]
background = "#0011DD"
transition = "zoom"
+++
## Template Example
---
This presentation shows how to take advantage of reveal-hugo's slide template feature.
---
Slide templates let you specify groups of slide attributes in one place and reuse them throughout the presentation.
---
{{< slide template="blue" >}}
Here's an example of using a template called `blue`, defined in the front matter of this presentation's `_index.md` file.
---
The template can contain any valid slide customization params:
```toml
[reveal_hugo.templates.blue]
background = "#0011DD"
transition = "zoom"
```
---
Then add it to any slide using the slide shortcode:
```
{{</* slide template="blue" */>}}
```

View File

@@ -0,0 +1,16 @@
+++
+++
{{< slide template="grey" >}}
Templates can be specified in `config.toml` as well, for reusability across multiple presentations.
```
[params.reveal_hugo.templates.grey]
background = "#424242"
transition = "convex"
```
---
## THE END