({ length })
7 | }
8 | // #endregion snippet
9 |
10 | export function sayHello() {
11 | console.log('Hello from snippets/external.ts')
12 | }
13 |
--------------------------------------------------------------------------------
/example/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "slidev",
3 | "type": "module",
4 | "private": true,
5 | "scripts": {
6 | "build": "slidev build --base /slidev-addon-rabbit/",
7 | "dev": "slidev --open",
8 | "export": "slidev export"
9 | },
10 | "dependencies": {
11 | "@slidev/theme-seriph": "latest",
12 | "slidev-addon-rabbit": "file:..",
13 | "vue": "^3.4.38"
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/example/pages/imported-slides.md:
--------------------------------------------------------------------------------
1 | # Imported Slides
2 |
3 | You can split your slides.md into multiple files and organize them as you want using the `src` attribute.
4 |
5 | #### `slides.md`
6 |
7 | ```markdown
8 | # Page 1
9 |
10 | Page 2 from main entry.
11 |
12 | ---
13 |
14 | ## src: ./subpage.md
15 | ```
16 |
17 |
18 |
19 | #### `subpage.md`
20 |
21 | ```markdown
22 | # Page 2
23 |
24 | Page 2 from another file.
25 | ```
26 |
27 | [Learn more](https://sli.dev/guide/syntax.html#importing-slides)
28 |
--------------------------------------------------------------------------------
/global-bottom.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
12 |
13 |
23 |
--------------------------------------------------------------------------------
/example/components/Counter.vue:
--------------------------------------------------------------------------------
1 |
12 |
13 |
14 |
15 |
23 | -
24 |
25 | {{ counter }}
26 |
34 | +
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/.github/workflows/npm-publish.yml:
--------------------------------------------------------------------------------
1 | # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2 | # For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
3 |
4 | name: Publich package to npmjs
5 |
6 | on:
7 | release:
8 | types: [created]
9 |
10 | jobs:
11 | publish-npm:
12 | runs-on: ubuntu-latest
13 | permissions:
14 | contents: read
15 | id-token: write
16 | steps:
17 | - uses: actions/checkout@v4
18 | - uses: actions/setup-node@v4
19 | with:
20 | node-version: '18.x'
21 | registry-url: https://registry.npmjs.org/
22 | - run: npm install -g npm
23 | - run: npm ci
24 | - run: npm publish --provenance --access public
25 | env:
26 | NODE_AUTH_TOKEN: ${{secrets.npm_token}}
27 |
--------------------------------------------------------------------------------
/.github/workflows/pages.yml:
--------------------------------------------------------------------------------
1 | name: Deploy example page
2 |
3 | on:
4 | push:
5 | branches:
6 | - main
7 |
8 | jobs:
9 | deploy:
10 | permissions:
11 | contents: read
12 | pages: write
13 | id-token: write
14 | runs-on: ubuntu-latest
15 | steps:
16 | - uses: actions/checkout@v4
17 | - uses: actions/setup-node@v4
18 | with:
19 | node-version: '18.x'
20 | - name: Configure GitHub Pages
21 | uses: actions/configure-pages@v5
22 | - name: Build example page
23 | run: |
24 | npm install
25 | npm run build --workspace=example
26 | - name: Upload artifact
27 | uses: actions/upload-pages-artifact@v3
28 | with:
29 | path: "example/dist"
30 | - name: Deploy to GitHub Pages
31 | id: deployment
32 | uses: actions/deploy-pages@v4
33 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2023 Yusuke Nemoto
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "slidev-addon-rabbit",
3 | "version": "0.4.0",
4 | "description": "Slidev addon for presentation time management inspired Rabbit",
5 | "engines": {
6 | "node": ">=18.0.0",
7 | "npm": ">=9.5.0"
8 | },
9 | "workspaces": [
10 | "example"
11 | ],
12 | "scripts": {
13 | "dev": "slidev example.md --remote 0.0.0.0",
14 | "build": "slidev build example.md",
15 | "export": "slidev export example.md",
16 | "screenshot": "slidev export example.md --format png",
17 | "test": "echo there is no test."
18 | },
19 | "repository": {
20 | "type": "git",
21 | "url": "git+https://github.com/kaakaa/slidev-addon-rabbit.git"
22 | },
23 | "keywords": [
24 | "slidev-addon",
25 | "slidev"
26 | ],
27 | "author": "kaakaa",
28 | "license": "MIT",
29 | "devDependencies": {
30 | "@slidev/cli": "^0.49.29",
31 | "@slidev/theme-default": "latest"
32 | },
33 | "dependencies": {
34 | "@iconify-json/emojione-monotone": "^1.1.4"
35 | },
36 | "bugs": {
37 | "url": "https://github.com/kaakaa/slidev-addon-rabbit/issues"
38 | },
39 | "homepage": "https://github.com/kaakaa/slidev-addon-rabbit#readme"
40 | }
41 |
--------------------------------------------------------------------------------
/components/Turtle.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
44 |
--------------------------------------------------------------------------------
/components/Rabbit.vue:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
12 | {{props.current}} / {{total}}
13 |
14 |
15 |
16 |
17 |
43 |
44 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | [](https://www.npmjs.com/package/slidev-addon-rabbit)
2 | # slidev-addon-rabbit
3 |
4 | Presentation time management for slidev inspired by [rabbit\-shocker/rabbit](https://github.com/rabbit-shocker/rabbit/) | [Rabbit \- はじめに](https://rabbit-shocker.org/ja/)
5 |
6 | # Demo
7 |
8 | https://kaakaa.github.io/slidev-addon-rabbit/1?time=1
9 |
10 | 
11 |
12 | ## Description
13 |
14 | As the presentation begins, the rabbit and the turtle aim for the goal. **The rabbit** represents **the current page**, and **the turtle** represents **the elapsed time** since the start. Let's guide the rabbit to the goal before the turtle arrives, ensuring everyone has enough leisure time.
15 |
16 | 
17 |
18 | ## Usage
19 |
20 | 1. Apply `slidev-addon-rabbit` to your slidev project
21 | - See [Use Addon \| Slidev](https://sli.dev/addons/use.html)
22 | 2. Run slidev (e.g.: `npm run dev`)
23 | 3. Attach url query `?time=10` to presentation url, and access it
24 | - e.g.: `http://localhost:3030/?time=10`
25 |
26 | ## Configs
27 |
28 |
29 | ```yaml
30 | ---
31 | ...
32 | addons:
33 | - slidev-addon-rabbit
34 | rabbit:
35 | slideNum: true # Show current/total slide numbers next to a rabbit icon
36 | ...
37 | ---
38 | ```
39 |
40 | # License
41 |
42 | This repository distributes under [MIT License](./LICENSE)
43 |
44 | Icons used in this slide are distributed from [Emoji One \(Monotone\)](https://icon-sets.iconify.design/emojione-monotone/) under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/deed.ja).
45 |
46 |
--------------------------------------------------------------------------------
/example/slides.md:
--------------------------------------------------------------------------------
1 | ---
2 | # You can also start simply with 'default'
3 | theme: seriph
4 | # random image from a curated Unsplash collection by Anthony
5 | # like them? see https://unsplash.com/collections/94734566/slidev
6 | background: https://cover.sli.dev
7 | # some information about your slides (markdown enabled)
8 | title: Welcome to Slidev
9 | info: |
10 | ## Slidev Starter Template
11 | Presentation slides for developers.
12 |
13 | Learn more at [Sli.dev](https://sli.dev)
14 | # apply unocss classes to the current slide
15 | class: text-center
16 | # https://sli.dev/features/drawing
17 | drawings:
18 | persist: false
19 | # slide transition: https://sli.dev/guide/animations.html#slide-transitions
20 | transition: slide-left
21 | # enable MDC Syntax: https://sli.dev/features/mdc
22 | mdc: true
23 | addons:
24 | - slidev-addon-rabbit
25 | rabbit:
26 | slideNum: true
27 | ---
28 |
29 | # Welcome to Slidev
30 |
31 | Presentation slides for developers
32 |
33 |
34 |
35 | Press Space for next page
36 |
37 |
38 |
39 |
48 |
49 |
52 |
53 | ---
54 | transition: fade-out
55 | ---
56 |
57 | # What is Slidev?
58 |
59 | Slidev is a slides maker and presenter designed for developers, consist of the following features
60 |
61 | - 📝 **Text-based** - focus on the content with Markdown, and then style them later
62 | - 🎨 **Themable** - themes can be shared and re-used as npm packages
63 | - 🧑💻 **Developer Friendly** - code highlighting, live coding with autocompletion
64 | - 🤹 **Interactive** - embed Vue components to enhance your expressions
65 | - 🎥 **Recording** - built-in recording and camera view
66 | - 📤 **Portable** - export to PDF, PPTX, PNGs, or even a hostable SPA
67 | - 🛠 **Hackable** - virtually anything that's possible on a webpage is possible in Slidev
68 |
69 |
70 |
71 | Read more about [Why Slidev?](https://sli.dev/guide/why)
72 |
73 |
77 |
78 |
89 |
90 |
93 |
94 | ---
95 | transition: slide-up
96 | level: 2
97 | ---
98 |
99 | # Navigation
100 |
101 | Hover on the bottom-left corner to see the navigation's controls panel, [learn more](https://sli.dev/guide/ui#navigation-bar)
102 |
103 | ## Keyboard Shortcuts
104 |
105 | | | |
106 | | --- | --- |
107 | | right / space | next animation or slide |
108 | | left / shift space | previous animation or slide |
109 | | up | previous slide |
110 | | down | next slide |
111 |
112 |
113 |
119 | Here!
120 |
121 | ---
122 | layout: two-cols
123 | layoutClass: gap-16
124 | ---
125 |
126 | # Table of contents
127 |
128 | You can use the `Toc` component to generate a table of contents for your slides:
129 |
130 | ```html
131 |
132 | ```
133 |
134 | The title will be inferred from your slide content, or you can override it with `title` and `level` in your frontmatter.
135 |
136 | ::right::
137 |
138 |
139 |
140 | ---
141 | layout: image-right
142 | image: https://cover.sli.dev
143 | ---
144 |
145 | # Code
146 |
147 | Use code snippets and get the highlighting directly, and even types hover!
148 |
149 | ```ts {all|5|7|7-8|10|all} twoslash
150 | // TwoSlash enables TypeScript hover information
151 | // and errors in markdown code blocks
152 | // More at https://shiki.style/packages/twoslash
153 |
154 | import { computed, ref } from 'vue'
155 |
156 | const count = ref(0)
157 | const doubled = computed(() => count.value * 2)
158 |
159 | doubled.value = 2
160 | ```
161 |
162 |
163 |
164 |
165 | <<< @/snippets/external.ts#snippet
166 |
167 |
168 |
169 | [Learn more](https://sli.dev/features/line-highlighting)
170 |
171 |
172 |
183 |
184 |
193 |
194 | ---
195 | level: 2
196 | ---
197 |
198 | # Shiki Magic Move
199 |
200 | Powered by [shiki-magic-move](https://shiki-magic-move.netlify.app/), Slidev supports animations across multiple code snippets.
201 |
202 | Add multiple code blocks and wrap them with ````md magic-move (four backticks) to enable the magic move. For example:
203 |
204 | ````md magic-move {lines: true}
205 | ```ts {*|2|*}
206 | // step 1
207 | const author = reactive({
208 | name: 'John Doe',
209 | books: [
210 | 'Vue 2 - Advanced Guide',
211 | 'Vue 3 - Basic Guide',
212 | 'Vue 4 - The Mystery'
213 | ]
214 | })
215 | ```
216 |
217 | ```ts {*|1-2|3-4|3-4,8}
218 | // step 2
219 | export default {
220 | data() {
221 | return {
222 | author: {
223 | name: 'John Doe',
224 | books: [
225 | 'Vue 2 - Advanced Guide',
226 | 'Vue 3 - Basic Guide',
227 | 'Vue 4 - The Mystery'
228 | ]
229 | }
230 | }
231 | }
232 | }
233 | ```
234 |
235 | ```ts
236 | // step 3
237 | export default {
238 | data: () => ({
239 | author: {
240 | name: 'John Doe',
241 | books: [
242 | 'Vue 2 - Advanced Guide',
243 | 'Vue 3 - Basic Guide',
244 | 'Vue 4 - The Mystery'
245 | ]
246 | }
247 | })
248 | }
249 | ```
250 |
251 | Non-code blocks are ignored.
252 |
253 | ```vue
254 |
255 |
265 | ```
266 | ````
267 |
268 | ---
269 |
270 | # Components
271 |
272 |
273 |
274 |
275 | You can use Vue components directly inside your slides.
276 |
277 | We have provided a few built-in components like ` ` and ` ` that you can use directly. And adding your custom components is also super easy.
278 |
279 | ```html
280 |
281 | ```
282 |
283 |
284 |
285 |
286 | Check out [the guides](https://sli.dev/builtin/components.html) for more.
287 |
288 |
289 |
290 |
291 | ```html
292 |
293 | ```
294 |
295 |
296 |
297 |
298 |
299 |
300 |
309 |
310 | ---
311 | class: px-20
312 | ---
313 |
314 | # Themes
315 |
316 | Slidev comes with powerful theming support. Themes can provide styles, layouts, components, or even configurations for tools. Switching between themes by just **one edit** in your frontmatter:
317 |
318 |
319 |
320 | ```yaml
321 | ---
322 | theme: default
323 | ---
324 | ```
325 |
326 | ```yaml
327 | ---
328 | theme: seriph
329 | ---
330 | ```
331 |
332 |
333 |
334 |
335 |
336 |
337 |
338 | Read more about [How to use a theme](https://sli.dev/guide/theme-addon#use-theme) and
339 | check out the [Awesome Themes Gallery](https://sli.dev/resources/theme-gallery).
340 |
341 | ---
342 |
343 | # Clicks Animations
344 |
345 | You can add `v-click` to elements to add a click animation.
346 |
347 |
348 |
349 | This shows up when you click the slide:
350 |
351 | ```html
352 |
This shows up when you click the slide.
353 | ```
354 |
355 |
356 |
357 |
358 |
359 |
360 |
361 | The v-mark directive
362 | also allows you to add
363 | inline marks
364 | , powered by [Rough Notation](https://roughnotation.com/):
365 |
366 | ```html
367 | inline markers
368 | ```
369 |
370 |
371 |
372 |
373 |
374 | [Learn more](https://sli.dev/guide/animations#click-animation)
375 |
376 |
377 |
378 | ---
379 |
380 | # Motions
381 |
382 | Motion animations are powered by [@vueuse/motion](https://motion.vueuse.org/), triggered by `v-motion` directive.
383 |
384 | ```html
385 |
392 | Slidev
393 |
394 | ```
395 |
396 |
397 |
423 |
424 |
429 | Slidev
430 |
431 |
432 |
433 |
434 |
448 |
449 |
453 |
454 | [Learn more](https://sli.dev/guide/animations.html#motion)
455 |
456 |
457 |
458 | ---
459 |
460 | # LaTeX
461 |
462 | LaTeX is supported out-of-box. Powered by [KaTeX](https://katex.org/).
463 |
464 |
465 |
466 | Inline $\sqrt{3x-1}+(1+x)^2$
467 |
468 | Block
469 | $$ {1|3|all}
470 | \begin{aligned}
471 | \nabla \cdot \vec{E} &= \frac{\rho}{\varepsilon_0} \\
472 | \nabla \cdot \vec{B} &= 0 \\
473 | \nabla \times \vec{E} &= -\frac{\partial\vec{B}}{\partial t} \\
474 | \nabla \times \vec{B} &= \mu_0\vec{J} + \mu_0\varepsilon_0\frac{\partial\vec{E}}{\partial t}
475 | \end{aligned}
476 | $$
477 |
478 | [Learn more](https://sli.dev/features/latex)
479 |
480 | ---
481 |
482 | # Diagrams
483 |
484 | You can create diagrams / graphs from textual descriptions, directly in your Markdown.
485 |
486 |
487 |
488 | ```mermaid {scale: 0.5, alt: 'A simple sequence diagram'}
489 | sequenceDiagram
490 | Alice->John: Hello John, how are you?
491 | Note over Alice,John: A typical interaction
492 | ```
493 |
494 | ```mermaid {theme: 'neutral', scale: 0.8}
495 | graph TD
496 | B[Text] --> C{Decision}
497 | C -->|One| D[Result 1]
498 | C -->|Two| E[Result 2]
499 | ```
500 |
501 | ```mermaid
502 | mindmap
503 | root((mindmap))
504 | Origins
505 | Long history
506 | ::icon(fa fa-book)
507 | Popularisation
508 | British popular psychology author Tony Buzan
509 | Research
510 | On effectiveness and features
511 | On Automatic creation
512 | Uses
513 | Creative techniques
514 | Strategic planning
515 | Argument mapping
516 | Tools
517 | Pen and paper
518 | Mermaid
519 | ```
520 |
521 | ```plantuml {scale: 0.7}
522 | @startuml
523 |
524 | package "Some Group" {
525 | HTTP - [First Component]
526 | [Another Component]
527 | }
528 |
529 | node "Other Groups" {
530 | FTP - [Second Component]
531 | [First Component] --> FTP
532 | }
533 |
534 | cloud {
535 | [Example 1]
536 | }
537 |
538 | database "MySql" {
539 | folder "This is my folder" {
540 | [Folder 3]
541 | }
542 | frame "Foo" {
543 | [Frame 4]
544 | }
545 | }
546 |
547 | [Another Component] --> [Example 1]
548 | [Example 1] --> [Folder 3]
549 | [Folder 3] --> [Frame 4]
550 |
551 | @enduml
552 | ```
553 |
554 |
555 |
556 | Learn more: [Mermaid Diagrams](https://sli.dev/features/mermaid) and [PlantUML Diagrams](https://sli.dev/features/plantuml)
557 |
558 | ---
559 | foo: bar
560 | dragPos:
561 | square: 691,32,167,_,-16
562 | ---
563 |
564 | # Draggable Elements
565 |
566 | Double-click on the draggable elements to edit their positions.
567 |
568 |
569 |
570 | ###### Directive Usage
571 |
572 | ```md
573 |
574 | ```
575 |
576 |
577 |
578 | ###### Component Usage
579 |
580 | ```md
581 |
582 |
583 | Use the `v-drag` component to have a draggable container!
584 |
585 | ```
586 |
587 |
588 |
589 | Double-click me!
590 |
591 |
592 |
593 |
594 |
595 | ###### Draggable Arrow
596 |
597 | ```md
598 |
599 | ```
600 |
601 |
602 |
603 | ---
604 | src: ./pages/imported-slides.md
605 | hide: false
606 | ---
607 |
608 | ---
609 |
610 | # Monaco Editor
611 |
612 | Slidev provides built-in Monaco Editor support.
613 |
614 | Add `{monaco}` to the code block to turn it into an editor:
615 |
616 | ```ts {monaco}
617 | import { ref } from 'vue'
618 | import { emptyArray } from './external'
619 |
620 | const arr = ref(emptyArray(10))
621 | ```
622 |
623 | Use `{monaco-run}` to create an editor that can execute the code directly in the slide:
624 |
625 | ```ts {monaco-run}
626 | import { version } from 'vue'
627 | import { emptyArray, sayHello } from './external'
628 |
629 | sayHello()
630 | console.log(`vue ${version}`)
631 | console.log(emptyArray(10).reduce(fib => [...fib, fib.at(-1)! + fib.at(-2)!], [1, 1]))
632 | ```
633 |
634 | ---
635 | layout: center
636 | class: text-center
637 | ---
638 |
639 | # Learn More
640 |
641 | [Documentation](https://sli.dev) · [GitHub](https://github.com/slidevjs/slidev) · [Showcases](https://sli.dev/resources/showcases)
642 |
643 |
644 |
--------------------------------------------------------------------------------