Skip to content

Latest commit

 

History

History
68 lines (48 loc) · 2.37 KB

File metadata and controls

68 lines (48 loc) · 2.37 KB
title date tags showTableOfContents showAuthor authors
asciinema casts
2024-03-18 10:55:37 +0100
Contribute
true
false
kirill-chalov

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:

{{< asciinema key="demo" idleTimeLimit="2" speed="1.5" poster="npt:0:09"

}}

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:

<script src="https://asciinema.org/a/342851.js" id="asciicast-342851" async="true"></script>

Resources