Add AsciiCast demos for docs

This commit is contained in:
Phil Scott
2021-05-20 21:03:17 -04:00
committed by Patrik Svensson
parent 69fdae70c0
commit 46abadaccb
95 changed files with 7920 additions and 179 deletions

View File

@ -0,0 +1,19 @@
using System.Collections.Generic;
using Statiq.Common;
using System.Linq;
namespace Docs.Shortcodes
{
public class AsciiCastShortcode : SyncShortcode
{
public override ShortcodeResult Execute(KeyValuePair<string, string>[] args, string content, IDocument document, IExecutionContext context)
{
// in the future I'd like to expand this to have two tabs, one with the full color unicode version
// and a second with the default plain.
var cast = args.First(i => i.Key == "cast").Value;
var profile = args.FirstOrDefault(i => i.Key == "profile").Value ?? "rich";
return $"<asciinema-player src=\"/assets/casts/{cast}-{profile}.cast\" autoplay></asciinema-player>";
}
}
}