mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-08-02 10:15:58 +08:00
Add AsciiCast demos for docs
This commit is contained in:

committed by
Patrik Svensson

parent
69fdae70c0
commit
46abadaccb
19
docs/src/Shortcodes/AsciicastShortcode.cs
Normal file
19
docs/src/Shortcodes/AsciicastShortcode.cs
Normal 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>";
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user