Skip to content

Commit

Permalink
feat: improves
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Apr 12, 2021
1 parent d78dcb1 commit 34d350d
Show file tree
Hide file tree
Showing 8 changed files with 185 additions and 74 deletions.
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@
},
"devDependencies": {
"@antfu/eslint-config": "^0.6.2",
"@antfu/utils": "^0.0.3",
"@antfu/utils": "^0.0.5",
"@iconify/json": "^1.1.328",
"@types/fs-extra": "^9.0.10",
"@types/fs-extra": "^9.0.11",
"@types/node": "^14.14.37",
"@types/nprogress": "^0.2.0",
"@types/prettier": "^2.2.3",
"@typescript-eslint/eslint-plugin": "^4.21.0",
"@vitejs/plugin-vue": "^1.2.1",
"@vue/compiler-sfc": "^3.0.11",
Expand All @@ -29,6 +30,7 @@
"markdown-it-prism": "^2.1.6",
"monaco-editor": "^0.23.0",
"pnpm": "^6.0.1",
"prettier": "^2.2.1",
"theme-vitesse": "^0.1.8",
"typescript": "^4.2.4",
"vite": "^2.1.5",
Expand Down
12 changes: 6 additions & 6 deletions plugins/slides.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { resolve } from 'path'
import { Plugin } from 'vite'
import fs from 'fs-extra'
import { isNotNull } from '@antfu/utils'
import { notNullish } from '@antfu/utils'
import matter from 'gray-matter'

const filepath = resolve(__dirname, '../slides.md')
Expand Down Expand Up @@ -54,15 +54,15 @@ export function createSlidesLoader(): Plugin {
raw = await read()
items = parse(raw)

const modules = [
const moduleEntries = [
'/@vite-slides/routes',
...items.map((i, idx) => `/@vite-slides/slides/${idx}.md`),
...items.map((i, idx) => `/@vite-slides/slide/${idx}.md`),
]
.map(id => ctx.server.moduleGraph.getModuleById(id))
.filter(isNotNull)
.filter(notNullish)

modules.map(m => ctx.server.moduleGraph.invalidateModule(m))
return modules
moduleEntries.map(m => ctx.server.moduleGraph.invalidateModule(m))
return moduleEntries
}
},

Expand Down
65 changes: 32 additions & 33 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 32 additions & 8 deletions slides.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,36 @@ Anthony Fu
---
---

# Markdown

## List

- All slides in one file
- HMR supported
- Light / Dark mode toggle
- Code snippets
- Prism syntax highlighting
- Built-in Moncoa Editor

---
---


# Table

| Tables | Are | Cool |
| ------------- |:-------------:| -----:|
| col 3 is | right-aligned | $1600 |
| col 2 is | centered | $12 |
| zebra stripes | are neat | $1 |

---
---

# Code Snippet Example

It, just works

<Transform scale='0.8'>

```html
<script setup lang="ts">
import { useFullscreen } from '@vueuse/core'
Expand All @@ -34,21 +58,21 @@ import { useFullscreen } from '@vueuse/core'
</template>
```

</Transform>

---
---

# Twitter Example
# Monaco Example

<Tweet url="https://twitter.com/antfu7/status/1362676666221268995" />
Live coding in your presentation! 😎

<Monaco />

---
---

# Monaco Example
# Twitter Example

<Monaco />
<Tweet url="https://twitter.com/antfu7/status/1362676666221268995" />

---
layout: end
Expand Down

0 comments on commit 34d350d

Please sign in to comment.