title | date | tags | showTableOfContents | showAuthor | authors | ||
---|---|---|---|---|---|---|---|
asciinema casts |
2024-03-18 10:55:37 +0100 |
|
true |
false |
|
asciinema allows you to record terminal sessions using a lightweight text-based format. You can easily embed asciinema casts on the Developer Portal.
- Copy text and commands directly from the video
- Add Markers similar to Youtube chapters
- Edit casts by manipulating the file contents or using asciinema-edit
Use asciinema casts for output logs or to demonstrate things in action. Avoid using asciinema casts for interactive guides as many users prefer scrolling through commands and copying them from code snippets instead of fishing the commands out of an asciinema cast.
- Install asciinema and record a terminal session following the Quick start guide.
- Edit the
.cast
file if required. - Add the .cast file in the same directory as your article.
- Embed a Hugo shortcode in your article.
For example, the shortcode below embeds the filedemo.cast
and adjusts some asciinema player options:{{</* asciinema key="demo" idleTimeLimit="2" speed="1.5" poster="npt:0:09" */>}}
The above shortcode will be rendered as follows:
{{< asciinema key="demo" idleTimeLimit="2" speed="1.5" poster="npt:0:09"
}}
You can embed a cast hosted on asciinema.org:
- Under the video, click the Share button
- Copy the code snippet provided under Embed the player and paste where needed, for example
<script src="https://asciinema.org/a/342851.js" id="asciicast-342851" async="true"></script>
The above shortcode will be rendered as follows:
<script src="https://asciinema.org/a/342851.js" id="asciicast-342851" async="true"></script>