Presentation
Add presentation in your VuePress site via Reveal.js.
Settings
Install @vuepress/plugin-revealjs in your project:
pnpm add -D @vuepress/plugin-revealjs@nextyarn add -D @vuepress/plugin-revealjs@nextnpm i -D @vuepress/plugin-revealjs@nextThen enabling via:
import { hopeTheme } from "vuepress-theme-hope";
export default hopeTheme({
markdown: {
revealjs: true,
},
});Slide Syntax
- Use
---to split slides - Use
--to split the slides second time (vertical display)
@slidestart
<!-- slide1 -->
---
<!-- slide2 -->
---
<!-- slide3 -->
@slideendA basic demo
@slidestart
## Slide Title
A paragraph with some text and a [link](https://mister-hope.com)
---
## Highlight
```js [2-4|1-5]
const add = (a, b) => {
if (typeof b === "undefined") return a + 1;
return a + b;
};
```
@slideendBy default, we use auto theme to render the presentation, but you can also use other themes with @slidestart THEME_NAME.
You can enable the following themes in reveal.js via themes in plugin options:
auto(Default)blackwhiteleaguebeigeskynightserifsimplesolarizedbloodmoon
For the appearance of each theme, see Themes demo.
Assets Path
Since Markdown contents between @slidestart and @slideend are handled by Reveal.js at browser, so you can only use absolute paths for assets in slides, which must be accessible directly in browser, relative paths or alias are not supported.
Demo
@slidestart
## Slide 1
A paragraph with some text and a [link](https://mister-hope.com)
---
## Slide 2
- Item 1
- Item 2
---
## Slide 3.1
```js
const a = 1;
```
--
## Slide 3.2
$$
J(\theta_0,\theta_1) = \sum_{i=0}
$$
@slideendInfo
For detailed demo, please see revealjs-demo.
Customize Reveal.js
Built-in Plugins
You can enable built-in plugins in reveal.js via plugins in plugin options. It accepts an array of the following plugin names:
highlightmathsearchnoteszoom
Note
markdown plugin is enabled anyway to support markdown grammar.
Advanced Configuration
You can also import and call defineRevealJsConfig in client config file to customize reveal.js:
import { defineRevealJsConfig } from "@vuepress/plugin-revealjs/client";
defineRevealJsConfig({
// reveal.js options here
});Note
Reveal.js also provides more plugins, you can add them via plugin option in defineRevealJsConfig. Built-in plugins you request at node side will be added automatically.
Per Page Configuration
You can also set revealJs to pass options to reveal.js per page in frontmatter.
For reveal.js options, see reveal.js config. For reveal.js usage, see reveal.js documentation
Changelog
1bd5f-on68504-on55e92-one639c-onb1230-on0cf8c-on22787-on99f51-onb41c0-on54c46-ond69ee-on55ea3-on757fd-on8e9aa-on83bff-on539b3-on7e98c-on254c5-on5c815-on8174c-onc8d60-on2243a-on2fa50-on3c8d6-on9856d-on23515-on48bca-on9cdd7-on63d09-onf635d-on570c6-on88e69-onfd395-on1eb77-on60053-on62d19-onf6ff0-on95e4f-on3c199-onace60-on5c29c-on8e875-on