From 46a45588127a90372dd58ab61e88c2809fb4c98b Mon Sep 17 00:00:00 2001 From: Murilo Cunha Date: Thu, 6 Jul 2023 20:02:11 +0200 Subject: [PATCH 1/3] add readme --- README.md | 117 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 115 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1cb2af4..15de71a 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,115 @@ -# slidev-addon-asciinema -Slidev addon to embed asciinema casts to presentations. +
+ + +
+ +# Asciinema player for Slidev + +> Slidev addon to embed asciinema casts to presentations. + +## Get started + +### Create a project + +With NPM: + +```console +npm init slidev +``` + +With Yarn: + +```console +yarn create slidev +``` + +With pnpm: + +```console +pnpm create slidev +``` + +### Add slidev addon + +With NPM: + +```console +npm install slidev-addon-asciinema +``` + +With Yarn: + +```console +yarn add slidev-addon-asciinema +``` + +With pnpm: + +```console +pnpm add slidev-addon-asciinema +``` + +### Declare the addon + +Either add in your `slides.md` top frontmatter: + +```yaml +theme: ... +... +addons: + - slidev-addon-asciinema +--- +# Slides markdown +``` + +Or add it in your `package.json` file: + +```json +{ + // ... + "scripts": { + // ... + }, + "slidev": { + "addons": [ + "slidev-addon-asciinema" + ] + } +} +``` + +### Use it in your presentation + +> 🚨 Wrap the component in `` tags. Slidev will otherwise render the component multiple times. See [#396](https://github.com/slidevjs/slidev/issues/396#issuecomment-1137191344) for more information. + +```md +# Example + + + + +``` + +The parameter `src` will look for static assets from the [`public` directory](https://sli.dev/custom/directory-structure.html#public). In this example, the file is be located at `your-project-root/public/casts/yourcast.cast`. + +### Customize your player + +All the[ `asciinema-player`'s options](https://github.com/asciinema/asciinema-player#options) are available via `:playerProps`. For example, one could change the speed and the number of lines of player's terminal with: + +```md +# Example + + + + +``` + +## Known issues + +There are a couple of issues already identified + +- Player placeholder is resized after playing cast - [#1](https://github.com/murilo-cunha/slidev-addon-asciinema/issues/1) +- Nerd fonts are not supported by the player - [#2](https://github.com/murilo-cunha/slidev-addon-asciinema/issues/2) +- Video's progress does not move in the same place where click happens - [#5](https://github.com/murilo-cunha/slidev-addon-asciinema/issues/5) + +Would you like to contribute? Leave a PR! 🚀 \ No newline at end of file From c8de39b0272febee8f06b04fda7ceea74d00b6b9 Mon Sep 17 00:00:00 2001 From: Murilo Cunha Date: Thu, 6 Jul 2023 22:40:58 +0200 Subject: [PATCH 2/3] add publishing demo slides to actions --- .github/workflows/publish.yaml | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index d63d49c..593fb10 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -2,8 +2,10 @@ name: Publish package to npmjs on: push: branches: [main] +env: + BASE: slidev-addon-asciinema jobs: - build: + publish: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -34,3 +36,31 @@ jobs: tag_name: "${{ env.TAG }}", generate_release_notes: true }) + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: '14' + - name: Install dependencies + run: yarn install + - name: Build + run: yarn build --base ${{ env.BASE }} + - name: Upload artifact + uses: actions/upload-pages-artifact@v1 + with: + path: dist/ + deploy: + needs: build + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + permissions: + pages: write + id-token: write + runs-on: ubuntu-latest + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v2 From 75c76aff8cbf0023a9e971c8f55e09f213fe01c8 Mon Sep 17 00:00:00 2001 From: Murilo Cunha Date: Thu, 6 Jul 2023 22:41:29 +0200 Subject: [PATCH 3/3] add more info on example slides --- example.md | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/example.md b/example.md index d8ea490..d1799b1 100644 --- a/example.md +++ b/example.md @@ -9,9 +9,31 @@ layout: cover layout: intro --- +# Usage + +See all `:playerProps` at [`asciinema player` docs](https://github.com/asciinema/asciinema-player) + +```md + + + +``` + +--- + # Demo - - \ No newline at end of file + + + +--- +layout: cover +--- + +## Check out the GitHub repo for more information! + +
+ +> [github.com/murilo-cunha/slidev-addon-asciinema](https://github.com/murilo-cunha/slidev-addon-asciinema)