Skip to main content

asciinema casts

·2 mins·
Contribute
Author
Kirill Chalov
Senior technical writer at Espressif
Table of Contents

Overview
#

asciinema allows you to record terminal sessions using a lightweight text-based format. You can easily embed asciinema casts on the Developer Portal.

Notable features
#

Word of caution
#

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.

Usage
#

How to upload and embed a cast
#

  1. Install asciinema and record a terminal session following the Quick start guide.
  2. Edit the .cast file if required.
  3. Add the .cast file in the same directory as your article.
  4. Embed a Hugo shortcode in your article.
    For example, the shortcode below embeds the file demo.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:

How to embed a cast from asciinema.org
#

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:

Resources
#