1. Project Overview & Quickstart (lirantal/LICENSE)
LICENSE
Open-source repository lirantal/LICENSE
Repository Details
- Repository: lirantal/LICENSE
- Primary Language: Code
Note: High-volume repository documentation is actively indexed and synchronized by YakaAI.
2. Official Technical Reference & Guides (lirantal/docs)
File: README.md
[sli.dev](https://sli.dev)
Documentation for Slidev
Translations
| Repo | Site | Maintainers | |
|---|---|---|---|
| English | docs | sli.dev | @antfu |
| ็ฎไฝไธญๆ | docs-cn | cn.sli.dev | @QC-L @Ivocin |
| Franรงais | docs-fr | fr.sli.dev | @ArthurDanjou |
| Espaรฑol | docs-es | es.sli.dev | @owlnai |
| ะ ัััะบะธะน | docs-ru | ru.sli.dev | @xesjkeee |
| Viแปt Nam | docs-vn | vn.sli.dev | @bongudth |
| Deutsch | docs-de | de.sli.dev | @fabiankachlock |
| Portuguรชs (BR) | docs-br | br.sli.dev | @luisfelipesdn12 |
| ฮฮปฮปฮทฮฝฮนฮบฮฌ | docs-el | el.sli.dev | @GeopJr |
| ๆฅๆฌ่ช | docs-ja | ja.sli.dev | @IkumaTadokoro |
Start Server Locally
npm i pnpm
pnpm i
pnpm run devAnd then visit http://localhost:3000
Or install the Vite extension for VS Code to edit side-by-side.
Help on Translating
See TRANSLATIONS.md
File: guide/animations.md
Animations
Click Animations
`v-click`
To apply "click animations" for elements, you can use the v-click directive or <v-click> components
# Hello
<v-click>
Hello World
</v-click>
Hey!`v-after`
The usage of v-after is similar to v-click but it will turn the element visible when the previous v-click is triggered.
Hello
WorldWhen you click the "next" button, both Hello and World will show up together.
`v-click-hide`
Same as v-click but instead of making the element appear, it makes the element invisible after clicking.
Hello`v-clicks`
v-clicks is only provided as a component. It's a shorthand to apply the v-click directive to all its child elements. It is especially useful when working with lists.
<v-clicks>
- Item 1
- Item 2
- Item 3
- Item 4
</v-clicks>An item will become visible each time you click "next".
Custom Clicks Count
By default, Slidev counts how many steps are needed before going to the next slide. You can override this setting by passing the clicks frontmatter option:
---
# 10 clicks in this slide, before going to the next
clicks: 10
---Ordering
Passing the click index to your directives, you can customize the order of the revealing
1
2
31
2
3---
clicks: 3
---
<v-clicks at="3">
Hi
</v-clicks>Element Transitions
When you apply the v-click directive to your elements, it will attach the class name slidev-vclick-target to it. When the elements are hidden, the class name slidev-vclick-hidden will also be attached. For example:
TextAfter a click, it will become
TextBy default, a subtle opacity transition is applied to those classes:
// the default
.slidev-vclick-target {
transition: opacity 100ms ease;
}
.slidev-vclick-hidden {
opacity: 0;
pointer-events: none;
}You can override them to customize the transition effects in your custom stylesheets.
For example, you can achieve the scaling up transitions by:
// styles.css
.slidev-vclick-target {
transition: all 500ms ease;
}
.slidev-vclick-hidden {
transform: scale(0);
}To specify animations for only certain slide or layout
.slidev-page-7,
.slidev-layout.my-custom-layout {
.slidev-vclick-target {
transition: all 500ms ease;
}
.slidev-vclick-hidden {
transform: scale(0);
}
}Learn more about customizing styles.
Motion
Slidev has @vueuse/motion built-in. You can use the v-motion directive to any elements to make apply motion on them. For example
SlidevThe text Slidev will move from -80px to its original position on initialization.
Note: Slidev preloads the next slide for performance, which means the animations might start before you navigate to the page. To get it works properly, you can disable the preloading for the particular slide
md--- preload: false ---Or control the element life-cycle with
v-ifto have fine-grained controlshtmlv-if="$slidev.nav.currentPage === 7" v-motion :initial="{ x: -80 }" :enter="{ x: 0 }"> Slidev
Learn mode: Demo | @vueuse/motion | v-motion | Presets
Pages Transitions
Built-in support for slides is NOT YET provided in the current version. We are planning to add support for them in the next major version. Before that, you can still use your custom styles and libraries to do that.
File: guide/drawing.md
Drawing & Annotations
Available since v0.23
We have drauu built-in for drawing and annotation that could enhance your presentation further.
To start, click the
Use with Stylus Pen
When using a stylus pen on a tablet (for example, iPad with Apple Pencil), Slidev could smartly detect the input type. You can directly draw on your slides with the pen without turning on the drawing mode, while having your fingers or mouse control the navigation.
Persist Drawings
The following frontmatter configuration allows you to persist your drawings as SVGs under .slidev/drawings directory and have them inside your exported pdf or hosted site.
---
drawings:
persist: true
---Disable Drawings
Entirely:
---
drawings:
enabled: false
---Only in Development:
---
drawings:
enabled: dev
---Only in Presenter Mode:
---
drawings:
presenterOnly: true
---Drawing Syncing
By default, Slidev syncs up your drawings across all instances. If you are sharing your slides with others, you might want to disable the syncing by:
---
drawings:
syncAll: false
---With this config, only the drawing from the presenter instance will be able to sync with others.
File: guide/editors.md
Editor Support
Since Slidev is using Markdown as the source entry, you can use ANY editors you love to write it.
If you want some high-level management to your slides, we have provided the following editor integrations for you!
Integrated Editor
Slidev comes with an integrated CodeMirror editor that will instantly reload and save the changes to your file.
Click the
VS Code Extension
The VS Code extension provides some features to help you better organize your slides and have a quick overview of them.
Features
- View slides in the side panel
- Go to next / prev buttons
- Re-ordering slides
- Folding for slide blocks
- Convert Markdown to HTML
File: guide/exporting.md
Exporting
Exporting to PDF or PNG relies on Playwright for rendering. You will therefore need to install
playwright-chromiumto use this feature.
If you are doing exporting in a CI environment, the playwright CI guide can be helpful.
Install playwright-chromium
$ npm i -D playwright-chromiumNow export your slides to PDF using the following command
$ slidev exportAfter a few seconds, your slides will be ready at ./slides-export.pdf.
In case you want to export your slides using the dark version of the theme, use the --dark option:
$ slidev export --darkExport Clicks Steps
Available since v0.21
By default, Slidev exports one page per slide with clicks animations disabled. If you want export slides with multiple steps into multiple pages, pass the --with-clicks options.
$ slidev export --with-clicksPNGs
When passing in the --format png option, Slidev will export PNG images for each slide instead of a PDF.
$ slidev export --format pngSingle-Page Application (SPA)
See Static Hosting.
File: guide/faq.md
FAQ
Grids
Since Slidev is based on the Web, you can apply any grid layouts as you want. CSS Grids, flexboxes, or even Masonry, you get the full controls.
Since we have Windi CSS built-in, here is one simple way for you to reference:
The first column
The second columnGo further, you can customize the size of each column like:
The first column (200px)
The second column (auto fit)
The third column (10% width to parent container)Learn more about Windi CSS Grids.
Positioning
Slides are defined in fixed sizes (default 980x552px) and scale to fit with the user screen. You can safely use absolute position in your slides as they will scale along with the screen.
For example:
This is a left-bottom aligned footerTo change the canvas' actual size, you can pass the canvasWidth options in your first frontmatter:
---
canvasWidth: 800
---Font Size
If you feel the font size in your slides are too small, you can adjust it in a few ways:
Override Local Style
You can override styles for each slide with the inlined <style> tag.
# Page 1
<style>
h1 {
font-size: 10em;
}
</style>
---
# Page 2
This will not be affected.Learn more: Embedded Styles
Override Global Style
You can provide custom global styles by creating ./style.css, for example
/* style.css */
h1 {
font-size: 10em !important;
}Learn more: Global Style
Scale the Canvas
Changing the canvas' actual size will scale all your contents(text, images, components, etc.) and slides
---
# default: 980
# since the canvas gets smaller, the visual size will become larger
canvasWidth: 800
---Use Transform
We provide a built-in component ``, which is a thin wrapper of CSS transform property.
- Item 1
- Item 2File: guide/hosting.md
Static Hosting
Build Single Page Applications (SPA)
You can also build the slides into a self-hostable SPA:
$ slidev buildThe generated application will be available under dist/ and then you can host it on GitHub Pages, Netlify, Vercel, or whatever you want. Now you can share your slides with the rest of the world with a single link.
Base Path
To deploy your slides under sub-routes, you will need to pass the --base option. For example:
$ slidev build --base /talks/my-cool-talk/Refer to Vite's documentation for more details.
Provide Downloadable PDF
You can provide a downloadable PDF to the viewers of your SPA with the following config:
---
download: true
---Slidev will generate a pdf file along with the build, and a download button will be displayed in the SPA.
You can also provide a custom url to the PDF. In that case, the rendering process will be skipped.
---
download: 'https://myside.com/my-talk.pdf'
---Examples
Here are a few examples of the exported SPA:
For more, check out Showcases.
Hosting
We recommend to use npm init slidev@lastest to scaffolding your project, which contains the necessary configuration files for hosting services out-of-box.
Netlify
Create netlify.toml in your project root with the following content.
[build.environment]
NODE_VERSION = "14"
[build]
publish = "dist"
command = "npm run build"
[[redirects]]
from = "/*"
to = "/index.html"
status = 200Then go to your Netlify dashboard, create new site with the repository.
Vercel
Create vercel.json in your project root with the following content.
{
"rewrites": [
{ "source": "/(.*)", "destination": "/index.html" }
]
}Then go to your Vercel dashboard, create new site with the repository.
GitHub Pages
Create .github/workflows/deploy.yml with following content to deploy your slides to GitHub Pages via GitHub Actions.
name: Deploy pages
on: push
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '14'
- name: Install dependencies
run: npm install
- name: Build
run: npm run build
- name: Deploy pages
uses: crazy-max/ghaction-github-pages@v2
with:
build_dir: dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}File: guide/index.md
Getting Started
Overview
Slidev (slide + dev, /slสษชdษชv/) is a web-based slides maker and presenter. It's designed for developers to focus on writing content in Markdown while also having the power of HTML and Vue components to deliver pixel-perfect layouts and designs with embedded interactive demos in your presentations.
It uses a feature-rich markdown file to generate beautiful slides with an instant reloading experience, along with many built-in integrations such as live coding, PDF exporting, presentation recording, and so on. Since it's powered by the web, you can do anything with Slidev - the possibilities are endless.
You can learn more about the rationale behind the project in the Why Slidev section.
Features
- ๐ Markdown-based - use your favorite editors and workflow
- ๐งโ๐ป Developer Friendly - built-in syntax highlighting, live coding, etc.
- ๐จ Themable - theme can be shared and used with npm packages
- ๐ Stylish - Windi CSS on-demand utilities, easy-to-use embedded stylesheets
- ๐คน Interactive - embedding Vue components seamlessly
- ๐ Presenter Mode - use another window, or even your phone to control your slides
- ๐จ Drawing - draw and annotate on your slides
- ๐งฎ LaTeX - built-in LaTeX math equations support
- ๐ฐ Diagrams - creates diagrams with textual descriptions
- ๐ Icons - Access to icons from any iconset directly
- ๐ป Editors - integrated editor, or extension for VS Code
- ๐ฅ Recording - built-in recording and camera view
- ๐ค Portable - export into PDF, PNGs, or even a hostable SPA
- โก๏ธ Fast - instant reloading powered by Vite
- ๐ Hackable - using Vite plugins, Vue components, or any npm packages
Tech Stack
Slidev is made possible by combining these tools and technologies.
- Vite - An extremely fast frontend tooling
- Vue 3 powered Markdown - Focus on the content while having the power of HTML and Vue components whenever needed
- Windi CSS - On-demand utility-first CSS framework, style your slides at ease
- Prism, Shiki, Monaco Editor - First-class code snippets support with live coding capability
- RecordRTC - Built-in recording and camera view
- VueUse family -
@vueuse/core,@vueuse/head,@vueuse/motion, etc. - Iconify - Iconsets collection.
- Drauu - Drawing and annotations support
- KaTeX - LaTeX math rendering.
- Mermaid - Textual Diagrams.
Scaffolding Your First Presentation
Try it Online
Create Locally
With NPM:
$ npm init slidevWith Yarn:
$ yarn create slidevFollow the prompts and start making your slides now! For more details about the markdown syntax, read through the syntax guide.
Command Line Interface
In a project where Slidev is installed, you can use the slidev binary in your npm scripts.
{
"scripts": {
"dev": "slidev", // start dev server
"build": "slidev build", // build for production SPA
"export": "slidev export" // export slides to pdf
}
}Otherwise, you can use it with npx
$ npx slidevRun slidev --help for more options available.
Markdown Syntax
Slidev reads your slides.md file under your project root and converts them into slides. Whenever you made changes to it, the content of the slides will be updated immediately. For example:
# Slidev
Hello World
---
# Page 2
Directly use code blocks for highlighting
//```ts
console.log('Hello, World!')
//```
---
# Page 3Read more about the Slidev Markdown syntax in the syntax guide.
File: guide/install.md
Installation
Starter Template
Slidev requires Node.js >=14.0
The best way to get started is using our official starter template.
With NPM:
$ npm init slidev@latestWith Yarn:
$ yarn create slidevFollow the prompts and it will open up the slideshow at http://localhost:3030/ automatically for you.
It also contains the basic setup and a short demo with instructions on how to get started with Slidev.
Install Manually
If you still prefer to install Slidev manually or would like to integrate it into your existing projects, you can do:
$ npm install @slidev/cli @slidev/theme-default$ touch slides.md$ npx slidevPlease note if you are using pnpm, you will need to enable shamefully-hoist option for Slidev to work properly:
bashecho 'shamefully-hoist=true' >> .npmrc
Install Globally
Available since v0.14
You can install Slidev globally with the following command
$ npm i @slidev/cliAnd then use slidev everywhere without creating a project every time.
$ slidevThis command will also try to use local @slidev/cli if it has been found in the node_modules.
Install on Docker
If you need a rapid way to run a presentation with containers, you can use the prebuilt docker image maintained by tangramor, or build your own.
Just run following command in your work folder:
docker run --name slidev --rm -it \
--user node \
-v ${PWD}:/slidev \
-p 3030:3030 \
tangramor/slidev:latestIf your work folder is empty, it will generate a template slides.md and other related files under your work folder, and launch the server on port 3030.
You can access your slides from http://localhost:3030/
Build deployable image
Or you can create your own slidev project to a docker image with Dockerfile:
FROM tangramor/slidev:latest
ADD . /slidevCreate the docker image: docker build -t myppt .
And run the container: docker run --name myslides --rm --user node -p 3030:3030 myppt
You can visit your slides from http://localhost:3030/
Build hostable SPA (Single Page Application)
Run command docker exec -i slidev npx slidev build on the running container slidev. It will generate static HTML files under dist folder.
Host on Github Pages
You can host dist in a static web site such as Github Pages or Gitlab Pages.
Because in Github pages the url may contain subfolder, so you need to modify the generated index.html to change href="/assets/xxx to href="./assets/xxx. Or you may use --base=/<subfolder>/ option during the build process, such as: docker exec -i slidev npx slidev build --base=/slidev_docker/.
And to avoid Jekyll build process, you need to add an empty file .nojekyll.
Host by docker
You can also host it by yourself with docker:
docker run --name myslides --rm -p 80:80 -v ${PWD}/dist:/usr/share/nginx/html nginx:alpineOr create a static image with following Dockerfile:
FROM nginx:alpine
COPY dist /usr/share/nginx/htmlCreate the docker image: docker build -t mystaticppt .
And run the container: docker run --name myslides --rm -p 80:80 mystaticppt
You can visit your slides from http://localhost/
Refer to the tangramor/slidev_docker for more details.
Command Line Interface (CLI)
@slidev/cli Expose a few commands you can use with npx slidev ... or by adding scripts in your package.json:
{
"script": {
"dev": "slidev"
}
}In that case you will be able to run npm run dev.
You can pass options to any commands:
- boolean option are
trueif they are present, false otherwise (example:slidev --open) - some options can have values you can add just after the option or by using the
=character (example:slidev --port 8080orslidev --port=8080)
If you use npm scripts, don't forget to add -- after the npm command:
npm run slidev -- --open`slidev [entry]`
Start a local server for Slidev.
[entry](string, default:slides.md): path to the slides markdown entry.
Options:
--port,-p(number, default:3030): port number.--open,-o(boolean, default:false): open in browser.--remote [password](string): listen to public host and enable remote control, if a value is passed then the presenter mode is private and only accessible by passing the given password in the URL querypasswordparameter.--log('error', 'warn', 'info', 'silent', default:'warn'): Log level.--force,-f(boolean, defaultfalse): force the optimizer to ignore the cache and re-bundle.--theme,-t(string): override theme.
`slidev build [entry]`
Build hostable SPA.
[entry](string, default:slides.md): path to the slides markdown entry.
Options:
--watch,-w(boolean, default:false): build watch.--out,-o(string, default:dist): output dir.--base(string, default:/): base URL (see https://cli.vuejs.org/config/#publicpath)--download(boolean, default:false): allow to download the slides as PDF inside the SPA.--theme,-t(string): override theme.
`slidev export [entry]`
Export slides to PDF (or other format).
[entry](string, default:slides.md): path to the slides markdown entry.
Options:
--output(string, default: useexportFilename(see https://sli.dev/custom/#frontmatter-configures) or use[entry]-export): path to the output.--base('pdf', 'png', 'md', default:'pdf'): output format.--timeout(number, default:30000): timeout for rendering the print page (see https://playwright.dev/docs/api/class-page#page-goto).--range(string): page ranges to export (example:'1,4-5,6').--dark(boolean, default:false): export as dark theme.--with-clicks,-c(boolean, default:false): export pages for every clicks (see https://sli.dev/guide/animations.html#click-animations).--theme,-t(string): override theme.
`slidev format [entry]`
Format the markdown file.
[entry](string, default:slides.md): path to the slides markdown entry.
`slidev theme [subcommand]`
Theme related operations.
Subcommands:
eject [entry]: Eject current theme into local file system[entry](string, default:slides.md): path to the slides markdown entry.- Options:
--dir(string, default:theme): output dir.--theme,-t(string): override theme.
File: guide/navigation.md
Navigation
Navigation Bar
Move your mouse to the left bottom corner of Slidev page, the navigation bar will be appeared.
| Shortcuts | Button | Description |
|---|---|---|
| f | toggle fullscreen | |
| right / space | next animation or slide | |
| left | previous animation or slide | |
| up | - | previous slide |
| down | - | next slide |
| o | toggle slides overview | |
| d | toggle dark mode | |
| - | toggle camera view | |
| - | recording | |
| - | enter presenter mode | |
| - | toggle integrated editor | |
| - | download slides (only appear in SPA build) | |
| - | show information about the slides | |
| - | show settings menu | |
| g | - | show goto... |
Slides Overview
By pressing o or clicking the