mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-04-13 15:42:50 +08:00
306 lines
17 KiB
Plaintext
306 lines
17 KiB
Plaintext
@using Docs.Extensions
|
|
@using Statiq.CodeAnalysis
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
<link href="@Context.GetLink("/assets/styles.css")" rel="stylesheet"/>
|
|
<link rel="preconnect" href="https://fonts.gstatic.com"/>
|
|
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;700&display=swap" rel="stylesheet"/>
|
|
|
|
<link rel="apple-touch-icon" sizes="180x180" href="@Context.GetLink("/assets/favicons/apple-touch-icon.png")">
|
|
<link rel="icon" type="image/png" sizes="32x32" href="@Context.GetLink("/assets/favicons/favicon-32x32.png")">
|
|
<link rel="icon" type="image/png" sizes="16x16" href="@Context.GetLink("/assets/favicons/favicon-16x16.png")">
|
|
|
|
@{
|
|
string title = Document.ContainsKey(Keys.Title) ? $"Spectre.Console - {Document.GetString(Keys.Title)}" : "Spectre.Console";
|
|
string description = Document.ContainsKey(Constants.Description) ? Document.GetString(Constants.Description) : "Spectre.Console is a .NET Standard 2.0 library that makes it easier to create beautiful console applications";
|
|
var card = Context.FindCard(Model.Id);
|
|
var urlBase = $"https://{Document.GetString(Keys.Host)}/";
|
|
}
|
|
<title>@title</title>
|
|
<meta name="description" content="@description"/>
|
|
<meta name="xref" content="@HtmlEncoder.Encode(Document.GetString(WebKeys.Xref))" />
|
|
|
|
@if (card != null)
|
|
{
|
|
<meta name="twitter:card" content="summary_large_image"/>
|
|
<meta name="og:title" content="@title"/>
|
|
<meta name="og:description" content="@description"/>
|
|
<meta name="og:image" content="@(urlBase + card)"/>
|
|
}
|
|
|
|
<script>
|
|
if (localStorage.theme === 'dark' || (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
|
|
document.documentElement.classList.add('dark');
|
|
} else {
|
|
document.documentElement.classList.remove('dark');
|
|
}
|
|
</script>
|
|
|
|
</head>
|
|
<body class="antialiased text-slate-800 dark:text-slate-200 bg-slate-100 dark:bg-slate-800 transition-colors min-h-full flex flex-col">
|
|
<header class="flex-none sticky top-0 z-40 text-sm font-medium bg-slate-200 backdrop-blur dark:bg-slate-800 ring-1 ring-slate-900 dark:ring-slate-700 ring-opacity-5 shadow-lg py-2 md:py-4">
|
|
<nav class="flex flex-row container mx-auto items-center">
|
|
<a class="flex flex-row items-center" href="@Context.GetLink("/")">
|
|
|
|
|
|
<svg xmlns="http://www.w3.org/2000/svg"
|
|
id="logo" class="w-auto h-10 md:h-12 fill-slate-700 dark:fill-slate-400 dark:stroke-slate-900" height="48" width="48" viewBox="0 0 1270.000000 1270.000000"
|
|
preserveAspectRatio="xMidYMid meet">
|
|
<metadata>
|
|
Created by potrace 1.16, written by Peter Selinger 2001-2019
|
|
</metadata>
|
|
<g transform="translate(0.000000,1270.000000) scale(0.100000,-0.100000)">
|
|
<path d="M799 10610 c-199 -48 -354 -191 -414 -383 l-25 -78 0 -3084 0 -3084
|
|
25 -79 c45 -141 155 -270 289 -335 124 -61 -80 -57 2819 -57 l2646 0 5 -43 c3
|
|
-23 8 -71 11 -105 13 -137 88 -334 179 -471 57 -85 187 -219 247 -254 25 -15
|
|
76 -34 112 -43 87 -22 163 -7 246 46 120 78 195 211 234 411 l23 124 14 -55
|
|
c63 -263 172 -511 326 -741 94 -142 229 -291 313 -348 272 -185 583 -197 750
|
|
-30 66 67 84 109 89 215 4 90 4 91 -51 230 -108 276 -137 477 -122 868 l7 196
|
|
77 0 c55 0 118 -11 229 -39 l154 -38 50 -84 c103 -172 221 -427 277 -599 38
|
|
-120 70 -274 86 -412 8 -75 21 -155 29 -178 37 -106 117 -199 220 -253 51 -26
|
|
202 -35 283 -17 83 18 193 97 268 192 157 199 256 485 286 825 11 122 6 524
|
|
-7 583 -5 24 -1 26 62 43 64 16 67 16 80 0 39 -50 109 -215 149 -351 25 -85
|
|
55 -174 67 -199 73 -156 261 -206 441 -117 65 32 110 70 159 135 128 169 178
|
|
414 157 764 -8 143 -38 350 -55 376 -2 4 7 25 22 46 77 112 168 344 200 504
|
|
l16 86 87 28 c188 60 391 170 498 269 132 122 183 230 183 383 0 71 -5 98 -24
|
|
138 -24 52 -82 112 -138 141 -52 28 -205 30 -378 5 -80 -11 -179 -23 -220 -27
|
|
l-75 -6 -29 56 c-33 65 -137 182 -211 236 -75 55 -156 94 -382 181 -110 43
|
|
-221 87 -245 100 -54 27 -92 69 -125 138 -25 52 -26 59 -20 180 4 69 16 200
|
|
26 291 52 430 53 809 5 1170 -54 405 -249 740 -569 979 -136 102 -297 190
|
|
-419 231 l-36 12 0 433 c0 433 0 434 -25 512 -52 167 -171 292 -341 360 l-69
|
|
28 -4215 2 c-2318 0 -4231 -3 -4251 -7z m8363 -1476 c417 -53 735 -193 962
|
|
-423 98 -98 155 -175 210 -282 84 -160 117 -292 141 -559 28 -313 17 -684 -30
|
|
-1025 -9 -60 -18 -164 -22 -230 -10 -208 22 -314 136 -452 76 -91 124 -118
|
|
391 -218 307 -116 377 -155 450 -249 23 -31 41 -58 39 -60 -2 -2 -47 8 -99 21
|
|
-131 35 -268 36 -360 3 -132 -47 -248 -116 -364 -218 -163 -143 -516 -488
|
|
-703 -687 -350 -372 -504 -514 -701 -644 -348 -231 -878 -408 -1322 -442 -409
|
|
-31 -796 45 -1059 208 -111 69 -249 210 -292 298 -32 65 -34 76 -33 165 1 104
|
|
23 178 85 287 75 131 137 194 430 441 181 152 251 295 250 511 -1 152 -16 223
|
|
-117 560 -35 117 -61 217 -58 222 3 5 20 9 38 9 55 0 217 31 261 50 53 23 103
|
|
73 132 131 43 88 56 187 59 437 2 266 -1 258 91 292 108 40 254 21 330 -45 35
|
|
-30 35 -32 53 -170 41 -311 106 -484 206 -546 48 -29 168 -48 381 -59 188 -10
|
|
432 -1 548 20 76 14 206 56 266 86 64 32 122 101 144 170 15 49 17 82 12 253
|
|
-5 198 -27 398 -52 482 -42 146 -125 221 -290 265 -57 15 -108 19 -268 19
|
|
l-197 0 0 45 c0 120 -37 255 -82 300 -76 77 -210 5 -291 -157 -31 -60 -67
|
|
-184 -67 -229 0 -27 -6 -34 -41 -50 -65 -29 -159 -98 -195 -144 -34 -43 -67
|
|
-119 -79 -181 l-6 -35 -57 28 c-114 57 -270 58 -379 2 -61 -31 -70 -21 -49 54
|
|
33 118 16 442 -29 536 -38 79 -114 84 -188 12 -68 -66 -136 -230 -137 -330 l0
|
|
-29 -61 7 c-34 3 -93 6 -131 6 l-69 0 6 48 c14 97 56 282 84 368 155 475 486
|
|
821 963 1008 108 42 308 94 430 110 62 9 124 17 138 20 76 11 479 5 592 -10z
|
|
m-7029 -78 c18 -8 261 -243 569 -552 582 -584 560 -559 543 -651 -6 -33 -69
|
|
-101 -523 -557 -553 -554 -564 -564 -644 -551 -89 15 -151 110 -128 198 10 37
|
|
65 95 463 495 l452 452 -472 473 c-414 414 -472 477 -478 510 -25 132 98 235
|
|
218 183z m7169 -1405 c164 -57 201 -136 234 -502 37 -414 9 -486 -212 -558
|
|
-155 -50 -298 -64 -579 -57 -249 6 -398 23 -439 50 -95 62 -177 346 -180 621
|
|
-1 135 0 142 28 203 50 109 148 179 304 218 149 37 329 53 567 50 191 -2 216
|
|
-4 277 -25z m-2002 -174 c95 -34 118 -52 152 -114 52 -94 63 -159 62 -368 -1
|
|
-358 -44 -479 -187 -520 -146 -42 -612 -65 -727 -36 -153 38 -196 98 -226 316
|
|
-16 120 -31 487 -21 527 9 35 89 121 140 151 99 58 228 76 522 73 200 -2 214
|
|
-3 285 -29z m-1604 -443 c45 -33 67 -70 71 -121 5 -59 -25 -117 -77 -147 -35
|
|
-21 -47 -21 -980 -24 -520 -2 -964 0 -988 3 -57 8 -116 60 -130 115 -19 75 12
|
|
146 78 182 34 17 75 18 1017 16 974 -3 982 -3 1009 -24z m5329 -2140 c66 -7
|
|
173 -14 237 -14 103 0 146 5 247 26 24 5 24 5 18 -64 -15 -159 -89 -371 -180
|
|
-515 l-43 -68 -57 113 c-72 145 -160 261 -318 422 l-126 128 51 -7 c28 -3 105
|
|
-13 171 -21z m-812 -652 c53 -41 140 -115 193 -165 96 -91 224 -231 224 -245
|
|
0 -5 -30 -18 -67 -30 -79 -25 -305 -84 -308 -80 -1 2 -12 53 -24 113 -28 135
|
|
-70 268 -127 402 -24 57 -44 106 -44 109 0 9 43 -20 153 -104z m-1173 -560
|
|
c-9 -4 -271 61 -315 78 -29 11 -28 12 79 55 59 24 111 46 114 49 3 3 33 -36
|
|
67 -87 34 -50 59 -93 55 -95z"/>
|
|
</g>
|
|
</svg>
|
|
<span class="text-lg md:text-2xl font-light ml-2 lg:ml-4 font-mono tracking-tighter">Spectre.Console</span>
|
|
</a>
|
|
<div class="ml-auto">
|
|
<ul class="flex flex-row">
|
|
<li>
|
|
<button aria-label="Toggle Dark Mode" class="mr-4 dark:text-yellow-300 stroke-1 opacity-80" onclick="swapTheme()">
|
|
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z"/>
|
|
</svg>
|
|
</button>
|
|
</li>
|
|
<li>
|
|
<a class="flex flex-row items-center text-rose-700 dark:text-rose-500" href="https://github.com/sponsors/patriksvensson">
|
|
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6 mr-1" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
|
<title>Sponsor</title>
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z"/>
|
|
</svg>
|
|
<span class="hidden sm:block">Sponsor</span>
|
|
</a>
|
|
</li>
|
|
<li class="ml-4">
|
|
<a class="flex flex-row items-center text-gray-600 fill-slate-200 stroke-slate-800 fill-slate-900 dark:stroke-slate-500 dark:fill-slate-300 dark:text-slate-300" href="https://github.com/spectreconsole/spectre.console">
|
|
<svg role="img" class="h-6 w-6 mr-1" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
|
<title>GitHub icon</title>
|
|
<path d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12"/>
|
|
</svg>
|
|
<span class="hidden sm:block">GitHub</span>
|
|
</a>
|
|
</li>
|
|
|
|
</ul>
|
|
</div>
|
|
</nav>
|
|
</header>
|
|
<main class="container mx-auto pt-8 w-full">
|
|
<div class="flex flex-col-reverse lg:flex-row">
|
|
<nav class="flex-none font-light text-sm xl:text-base sm:mr-16 mt-8 pt-6 lg:mt-0 lg:pt-0 lg:pb-10 border-t border-gray-300 lg:border-t-0">
|
|
@{
|
|
var sidebar = Context.GetSidebar();
|
|
var root = sidebar.Node;
|
|
<div class="text-xl @(Document.IdEquals(root) ? "font-bold" : null)">
|
|
@if (sidebar.ShowLink)
|
|
{
|
|
@Html.DocumentLink(root)
|
|
}
|
|
else
|
|
{
|
|
@sidebar.Title;
|
|
}
|
|
</div>
|
|
|
|
@foreach (var sidebarItem in sidebar.Leafs)
|
|
{
|
|
var document = sidebarItem.Node;
|
|
if (string.IsNullOrWhiteSpace(sidebarItem.Title))
|
|
{
|
|
continue;
|
|
}
|
|
|
|
var documentChildren = sidebarItem.Leafs;
|
|
<div class="text-teal-800 font-medium dark:text-teal-400 mt-4">
|
|
@if (sidebarItem.ShowLink)
|
|
{
|
|
@Html.DocumentLink(document)
|
|
}
|
|
else
|
|
{
|
|
@sidebarItem.Title;
|
|
}
|
|
</div>
|
|
|
|
@if (documentChildren.Any())
|
|
{
|
|
<div class="ml-2 flex flex-row flex-wrap lg:flex-col border-separate">
|
|
@foreach (var childItem in documentChildren)
|
|
{
|
|
var child = childItem.Node;
|
|
<div class="mt-2 mr-4 @(Document.IdEquals(child) ? "font-bold" : null)">
|
|
@Html.DocumentLink(child)
|
|
</div>
|
|
}
|
|
</div>
|
|
}
|
|
}
|
|
}
|
|
</nav>
|
|
<article class="flex-1 min-w-0">
|
|
<header class="text-slate-900 dark:text-slate-50 mb-4">
|
|
@RenderSection("header", required: false)
|
|
@if (!IsSectionDefined("header"))
|
|
{
|
|
<h1 class="text-2xl md:text-4xl font-extrabold">@(Document.GetString(Keys.Title) ?? Document.GetTitle())</h1>
|
|
}
|
|
|
|
@RenderSection("subheading", required: false)
|
|
</header>
|
|
<div class="prose prose-sm md:prose-base prose-slate dark:prose-invert max-w-full font-light lg:leading-loose">
|
|
@RenderBody()
|
|
|
|
@{
|
|
var referenceLinks = Model.GetList<string>(Constants.ApiReference);
|
|
if (referenceLinks != null)
|
|
{
|
|
<h3>References</h3>
|
|
<ul>
|
|
@foreach (var link in referenceLinks)
|
|
{
|
|
if (Context.TryGetXrefDocument(link, out var refDoc, out string error))
|
|
{
|
|
<li>
|
|
@{
|
|
var kind = refDoc.GetString(CodeAnalysisKeys.SpecificKind);
|
|
var prefix = string.Empty;
|
|
var containingType = @refDoc.GetDocument(CodeAnalysisKeys.ContainingType);
|
|
if (containingType != null)
|
|
{
|
|
prefix = containingType.GetString(CodeAnalysisKeys.DisplayName) + ".";
|
|
}
|
|
}
|
|
|
|
@if (!string.IsNullOrWhiteSpace(prefix)){ <span class="text-slate-600 dark:text-slate-400">@prefix</span>}@Html.DocumentLink(refDoc, refDoc.GetString(CodeAnalysisKeys.DisplayName) ?? refDoc.GetTitle()) <span class="ml-4 uppercase text-xs text-slate-700 dark:text-slate-400">@kind</span>
|
|
</li>
|
|
}
|
|
else
|
|
{
|
|
Context.LogWarning(Model, $"Error finding xref for {link} - {error}");
|
|
}
|
|
}
|
|
</ul>
|
|
}
|
|
}
|
|
</div>
|
|
</article>
|
|
</div>
|
|
</main>
|
|
|
|
<footer class="py-4 md:py-8 mt-8 bg-gray-100 dark:bg-slate-800 text-sm border-t border-gray-200 dark:border-slate-700">
|
|
<div class="container">
|
|
<div class="flex flex-row">
|
|
<span>© @DateTime.Today.Year Patrik Svensson, Phil Scott, Nils Andresens</span>
|
|
<span class="ml-auto">@VersionUtilities.GetVersion()</span>
|
|
</div>
|
|
</div>
|
|
</footer>
|
|
|
|
|
|
<script>
|
|
// adapted from https://www.w3schools.com/howto/howto_js_filter_table.asp
|
|
function search(input, searchTarget, columnIndex) {
|
|
// Declare variables
|
|
var filter, table, tr, td, i, txtValue;
|
|
filter = input.value.toUpperCase();
|
|
table = document.getElementById(searchTarget);
|
|
tr = table.getElementsByTagName("tr");
|
|
|
|
// Loop through all table rows, and hide those who don't match the search query
|
|
for (i = 0; i < tr.length; i++) {
|
|
td = tr[i].getElementsByTagName("td")[columnIndex];
|
|
if (td) {
|
|
txtValue = td.textContent || td.innerText;
|
|
if (txtValue.toUpperCase().indexOf(filter) > -1) {
|
|
tr[i].style.display = "";
|
|
} else {
|
|
tr[i].style.display = "none";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.23.0/prism.min.js" integrity="sha512-YBk7HhgDZvBxmtOfUdvX0z8IH2d10Hp3aEygaMNhtF8fSOvBZ16D/1bXZTJV6ndk/L/DlXxYStP8jrF77v2MIg==" crossorigin="anonymous"></script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/prism/1.23.0/plugins/autoloader/prism-autoloader.min.js" integrity="sha512-zc7WDnCM3aom2EziyDIRAtQg1mVXLdILE09Bo+aE1xk0AM2c2cVLfSW9NrxE5tKTX44WBY0Z2HClZ05ur9vB6A==" crossorigin="anonymous"></script>
|
|
<script src="@Context.GetLink("/assets/asciinema-player.js")"></script>
|
|
<script>
|
|
document.querySelectorAll('asciinema-player').forEach(cast => {
|
|
AsciinemaPlayer.create(cast.attributes['src'].value, cast, {autoplay: true, fit: 'none', fontSize: 'inherit'});
|
|
});
|
|
</script>
|
|
|
|
<script>
|
|
function swapTheme(){
|
|
if (document.documentElement.classList.contains('dark')) {
|
|
document.documentElement.classList.remove('dark');
|
|
localStorage.theme = 'light';
|
|
} else {
|
|
document.documentElement.classList.add('dark');
|
|
localStorage.theme = 'dark';
|
|
}
|
|
}
|
|
</script>
|
|
</body>
|
|
</html> |