Back to Slidev

Welcome to Slidev

packages/slidev/template.md

52.19.09.1 KB
Original Source

Welcome to Slidev

Presentation slides for developers

<div class="pt-12"> <span @click="$slidev.nav.next" class="px-2 py-1 rounded cursor-pointer" flex="~ justify-center items-center gap-2" hover="bg-white bg-opacity-10"> Press Space for next page <div class="i-carbon:arrow-right inline-block"/> </span> </div> <div class="abs-br m-6 flex gap-2"> <button @click="$slidev.nav.openInEditor()" title="Open in Editor" class="text-xl slidev-icon-btn opacity-50 !border-none !hover:text-white"> <div class="i-carbon:edit" /> </button> <a href="https://github.com/slidevjs/slidev" target="_blank" alt="GitHub" title="Open in GitHub" class="text-xl slidev-icon-btn opacity-50 !border-none !hover:text-white"> <carbon-logo-github /> </a> </div> <!-- The last comment block of each slide will be treated as slide notes. It will be visible and editable in Presenter Mode along with the slide. [Read more in the docs](https://sli.dev/guide/syntax.html#notes) -->

transition: fade-out

What is Slidev?

Slidev is a slide maker and accompanying presentation tool designed for developers. It consists of the following features:

  • ๐Ÿ“ Text-based - focus on the content with Markdown, and apply styles later
  • ๐ŸŽจ Themable - themes can be shared and used as npm packages
  • ๐Ÿง‘โ€๐Ÿ’ป Developer Friendly - code highlighting, live coding with autocompletion
  • ๐Ÿคน Interactive - embedding Vue components to enhance your slides
  • ๐ŸŽฅ Recording - built-in recording and camera view
  • ๐Ÿ“ค Portable - export to PDF, PPTX, PNGs, or even a hostable SPA
  • ๐Ÿ›  Hackable - virtually anything that's possible on a webpage is possible in Slidev

Read more about Slidev in Why Slidev?

<!-- You can have `style` tags in markdown to override the style for the current page. Learn more: https://sli.dev/guide/syntax#embedded-styles --> <style> h1 { background-color: #2B90B6; background-image: linear-gradient(45deg, #4EC5D4 10%, #146b8c 20%); background-size: 100%; -webkit-background-clip: text; -moz-background-clip: text; -webkit-text-fill-color: transparent; -moz-text-fill-color: transparent; } </style> <!-- Here is another comment. -->

layout: default

Table of contents

html
<Toc minDepth="1" maxDepth="1"></Toc>

<Toc maxDepth="1"></Toc>


transition: slide-up level: 2

Navigation

Hover on the bottom-left corner to see the navigation's control panel, learn more

Keyboard Shortcuts

<kbd>right</kbd> / <kbd>space</kbd>next animation or slide
<kbd>left</kbd> / <kbd>shift</kbd><kbd>space</kbd>previous animation or slide
<kbd>up</kbd>previous slide
<kbd>down</kbd>next slide
<!-- https://sli.dev/guide/animations.html#click-animation --> <p v-after class="absolute bottom-23 left-45 opacity-30 transform -rotate-10">Here!</p>

layout: image-right image: https://cover.sli.dev

Code

Use code snippets and get automatic highlighting, and even types hover!1

ts
// TwoSlash enables TypeScript hover information
// and errors in markdown code blocks
// More at https://shiki.style/packages/twoslash

import { computed, ref } from 'vue'

const count = ref(0)
const doubled = computed(() => count.value * 2)

doubled.value = 2
<arrow v-click="[4, 5]" x1="350" y1="310" x2="195" y2="334" color="#953" width="2" arrowSize="1" /> <!-- This allow you to embed external code blocks --> <!-- <<< @/snippets/external.ts#snippet --> <!-- Footer --> <!-- Inline style --> <style> .footnotes-sep { @apply mt-5 opacity-10; } .footnotes { @apply text-sm opacity-75; } .footnote-backref { display: none; } </style>

Components

<div grid="~ cols-2 gap-4"> <div>

You can use Vue components directly inside your slides.

We have provided a few built-in components like <Tweet/> and <Youtube/> that you can use directly. Adding your own custom components is also super easy.

html
<Counter :count="10" />
<!-- ./components/Counter.vue --> <Counter :count="10" m="t-4" />

Check out the guides for more.

</div> <div>
html
<Tweet id="1390115482657726468" />
<Tweet id="1390115482657726468" scale="0.65" /> </div> </div> <!-- Presenter notes with **bold**, *italic*, and ~~strike~~ text. Also, HTML elements are valid: <div class="flex w-full"> <span style="flex-grow: 1;">Left content</span> <span>Right content</span> </div> -->

class: px-20

Themes

Slidev comes with powerful theming support. Themes can provide styles, layouts, components, or even configurations for tools. Switch between themes on a per-slide basis with just one change in your frontmatter:

<div grid="~ cols-2 gap-2" m="t-2">
yaml
---
theme: default
---
yaml
---
theme: seriph
---
</div>

Read more about How to use a theme and check out the Awesome Themes Gallery.


preload: false

Animations

Animations are powered by @vueuse/motion.

html
<div
  v-motion
  :initial="{ x: -80 }"
  :enter="{ x: 0 }">
  Slidev
</div>
<div class="w-60 relative mt-6"> <div class="relative w-40 h-40"> </div> <div class="text-5xl absolute top-14 left-40 text-[#2B90B6] -z-1" v-motion :initial="{ x: -80, opacity: 0}" :enter="{ x: 0, opacity: 1, transition: { delay: 2000, duration: 1000 } }"> Slidev </div> </div> <!-- vue script setup scripts can be directly used in markdown, and will only affect the current page --> <script setup lang="ts"> const final = { x: 0, y: 0, rotate: 0, scale: 1, transition: { type: 'spring', damping: 10, stiffness: 20, mass: 2 } } </script> <div v-motion :initial="{ x:35, y: 40, opacity: 0}" :enter="{ y: 0, opacity: 1, transition: { delay: 3500 } }">

Learn More

</div>

LaTeX

LaTeX is supported out-of-box powered by KaTeX.

Inline $\sqrt{3x-1}+(1+x)^2$

Block $$ {1|3|all} \begin{array}{c}

\nabla \times \vec{\mathbf{B}} -, \frac1c, \frac{\partial\vec{\mathbf{E}}}{\partial t} & = \frac{4\pi}{c}\vec{\mathbf{j}} \nabla \cdot \vec{\mathbf{E}} & = 4 \pi \rho \

\nabla \times \vec{\mathbf{E}}, +, \frac1c, \frac{\partial\vec{\mathbf{B}}}{\partial t} & = \vec{\mathbf{0}} \

\nabla \cdot \vec{\mathbf{B}} & = 0

\end{array} $$

Learn more


Diagrams

You can create diagrams / graphs from textual descriptions, directly in your Markdown.

<div class="grid grid-cols-4 gap-5 pt-4 -mb-6">
mermaid
sequenceDiagram
    Alice->John: Hello John, how are you?
    Note over Alice,John: A typical interaction
mermaid
graph TD
B[Text] --> C{Decision}
C -->|One| D[Result 1]
C -->|Two| E[Result 2]
mermaid
mindmap
  root((mindmap))
    Origins
      Long history
      ::icon(fa fa-book)
      Popularisation
        British popular psychology author Tony Buzan
    Research
      On effectivness
and features
      On Automatic creation
        Uses
            Creative techniques
            Strategic planning
            Argument mapping
    Tools
      Pen and paper
      Mermaid
plantuml
@startuml

package "Some Group" {
  HTTP - [First Component]
  [Another Component]
}

node "Other Groups" {
  FTP - [Second Component]
  [First Component] --> FTP
}

cloud {
  [Example 1]
}

database "MySql" {
  folder "This is my folder" {
    [Folder 3]
  }
  frame "Foo" {
    [Frame 4]
  }
}

[Another Component] --> [Example 1]
[Example 1] --> [Folder 3]
[Folder 3] --> [Frame 4]

@enduml
</div>

Learn More


layout: center class: text-center

Learn More

Documentation ยท GitHub ยท Showcases

Footnotes

  1. Learn More โ†ฉ