Add asciinema shortcode and try in Playground
This commit is contained in:
@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta http-equiv="Content-Security-Policy" content="default-src 'self' 'unsafe-inline' data: ;">
|
||||
<meta http-equiv="Content-Security-Policy" content="default-src 'self' 'unsafe-inline' data: ;{{ if .Params.asciinema }}script-src 'self' 'unsafe-inline' 'unsafe-eval';{{ end }}">
|
||||
<title>
|
||||
{{- block "title" . -}}
|
||||
{{ .Site.Title }}
|
||||
@ -13,6 +13,9 @@
|
||||
<!-- Diable favicon requests: https://stackoverflow.com/a/13416784 -->
|
||||
<link rel="icon" href="data:;base64,iVBORw0KGgo=">
|
||||
<link href="/assets/bootstrap.min.css" rel="stylesheet" >
|
||||
{{ if .Params.asciinema }}
|
||||
<link rel="stylesheet" type="text/css" href="/assets/asciinema-player.css" />
|
||||
{{ end }}
|
||||
<style>
|
||||
{{- block "styles" . -}}
|
||||
{{- end -}}
|
||||
|
20
layouts/shortcodes/asciinema.html
Normal file
20
layouts/shortcodes/asciinema.html
Normal file
@ -0,0 +1,20 @@
|
||||
<div id='{{ with .Get "key" }}{{ . }}{{ end }}'></div>
|
||||
<script src="/assets/asciinema-player.min.js"></script>
|
||||
<script>
|
||||
AsciinemaPlayer.create('/casts/{{ with .Get "key" }}{{ . }}{{ end }}.cast', document.getElementById('{{ with .Get "key" }}{{ . }}{{ end }}'), {
|
||||
{{ if .Get "cols" }}cols: "{{ .Get "cols" }}",{{ end }}
|
||||
{{ if .Get "rows" }}rows: "{{ .Get "rows" }}",{{ end }}
|
||||
{{ if .Get "autoPlay" }}autoPlay: "{{ .Get "autoPlay" }}",{{ end }}
|
||||
{{ if .Get "preload" }}preload: "{{ .Get "preload" }}",{{ end }}
|
||||
{{ if .Get "loop" }}loop: "{{ .Get "loop" }}",{{ end }}
|
||||
{{ if .Get "startAt" }}startAt: "{{ .Get "startAt" }}",{{ end }}
|
||||
{{ if .Get "speed" }}speed: "{{ .Get "speed" }}",{{ end }}
|
||||
{{ if .Get "idleTimeLimit" }}idleTimeLimit: "{{ .Get "idleTimeLimit" }}",{{ end }}
|
||||
{{ if .Get "theme" }}theme: "{{ .Get "theme" }}",{{ end }}
|
||||
{{ if .Get "poster" }}poster: "{{ .Get "poster" }}",{{ end }}
|
||||
{{ if .Get "fit" }}fit: "{{ .Get "fit" }}",{{ end }}
|
||||
{{ if .Get "terminalFontSize" }}terminalFontSize: "{{ .Get "terminalFontSize" }}",{{ end }}
|
||||
{{ if .Get "terminalFontFamily" }}terminalFontFamily: "{{ .Get "terminalFontFamily" }}",{{ end }}
|
||||
{{ if .Get "terminalLineHeight" }}terminalLineHeight: "{{ .Get "terminalLineHeight" }}",{{ end }}
|
||||
});
|
||||
</script>
|
Reference in New Issue
Block a user