Add experimental Asciinema support

This commit is contained in:
Alex Shpak
2025-09-25 17:08:11 +02:00
parent 933206fedd
commit fe67dfeed1
9 changed files with 3966 additions and 1 deletions
+15
View File
@@ -0,0 +1,15 @@
{{- if not (.Page.Store.Get "asciinema") -}}
<!-- Include asciinema player only first time -->
<link rel="stylesheet" href="{{ "asciinema/asciinema-player.css" | relURL }}" />
<script defer src="{{ "asciinema/asciinema-player.min.js" | relURL }}"></script>
<script defer src="{{ "asciinema/asciinema-auto.js" | relURL }}"></script>
{{- .Page.Store.Set "asciinema" true -}}
{{- end -}}
{{- with (partial "docs/links/portable-image" (dict "Page" .Page "Destination" (index .Params "cast"))) -}}
{{- $opts := newScratch -}}
{{- $opts.Set "asciinema" $.Params -}}
{{- $opts.DeleteInMap "asciinema" "cast" -}}
<div class="asciinema" id="asciinema-{{ $.Ordinal }}" x-data-cast="{{ . | safeHTMLAttr }}" x-data-opts="{{ $opts.Get "asciinema" | jsonify | safeHTMLAttr }}"></div>
{{- end -}}