diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f6eeecea..69b9b0c1 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -21,7 +21,8 @@ jobs: - name: Setup dotnet uses: actions/setup-dotnet@v1 with: - dotnet-version: 5.0.301 + dotnet-version: 6.0.x + include-prerelease: true - name: Setup Node.js uses: actions/setup-node@v2 diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index 6cadf1e4..3fd6568d 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -24,7 +24,8 @@ jobs: - name: Setup dotnet uses: actions/setup-dotnet@v1 with: - dotnet-version: 5.0.301 + dotnet-version: 6.0.x + include-prerelease: true - name: Setup Node.js uses: actions/setup-node@v2 diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 5bdc37a2..2569948e 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -29,7 +29,8 @@ jobs: - name: Setup dotnet uses: actions/setup-dotnet@v1 with: - dotnet-version: 5.0.301 + dotnet-version: 6.0.x + include-prerelease: true - name: Build shell: bash diff --git a/docs/.gitignore b/docs/.gitignore index 56a2f3a5..35ae38b7 100644 --- a/docs/.gitignore +++ b/docs/.gitignore @@ -7,6 +7,7 @@ [Tt]ools/ ![Tt]ools/packages.config [Oo]utput/ +[Cc]ache/ ![Ii]nput/ nuget.exe *.com diff --git a/docs/Docs.csproj b/docs/Docs.csproj index 84b8fc8a..283d4ca7 100644 --- a/docs/Docs.csproj +++ b/docs/Docs.csproj @@ -1,10 +1,11 @@ - + Exe - net5.0 + net6.0 $(MSBuildProjectDirectory) $(DefaultItemExcludes);output\**;.gitignore + MVC1000 true @@ -31,7 +32,9 @@ - + + + diff --git a/docs/Program.cs b/docs/Program.cs index b1a87c88..a61856c2 100644 --- a/docs/Program.cs +++ b/docs/Program.cs @@ -22,7 +22,7 @@ namespace Docs .AddShortcode("Alert", typeof(AlertShortcode)) .AddShortcode("AsciiCast", typeof(AsciiCastShortcode)) .AddPipelines() - .AddProcess(ProcessTiming.Initialization, _ => new ProcessLauncher("npm", "install") + .AddProcess(ProcessTiming.Initialization, _ => new ProcessLauncher("npm", "install", "--audit", "false", "--fund", "false") { LogErrors = false }) diff --git a/docs/global.json b/docs/global.json new file mode 100644 index 00000000..7281fbff --- /dev/null +++ b/docs/global.json @@ -0,0 +1,6 @@ +{ + "sdk": { + "version": "2.2.200", + "rollForward": "latestMajor" + } +} \ No newline at end of file diff --git a/docs/input/_layout.cshtml b/docs/input/_layout.cshtml index 78fd1f86..b8327497 100644 --- a/docs/input/_layout.cshtml +++ b/docs/input/_layout.cshtml @@ -14,11 +14,21 @@ @{ - 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"; + 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 = Outputs.FirstOrDefault(i => i.GetString("DocId") == Model.Id.ToString()); + var urlBase = $"https://{Document.GetString(Keys.Host)}/"; } @title + + @if(card != null){ + + + + + } +
@@ -66,7 +76,7 @@ } - @foreach (IDocument document in OutputPages.GetChildrenOf(root).OnlyVisible()) + @foreach (IDocument document in OutputPages.GetChildrenOf(root).OrderBy(i => i.GetInt("Order")).OnlyVisible()) { if(string.IsNullOrWhiteSpace(document.GetTitle())) { @@ -100,7 +110,10 @@ }
-

@(Document.GetString(Keys.Title) ?? Document.GetTitle())

+
+

@(Document.GetString(Keys.Title) ?? Document.GetTitle())

+ @RenderSection("subheading", required: false) +
@RenderBody()
diff --git a/docs/input/_posts.cshtml b/docs/input/_posts.cshtml deleted file mode 100644 index 735ddd24..00000000 --- a/docs/input/_posts.cshtml +++ /dev/null @@ -1,42 +0,0 @@ -
- @foreach (IDocument post in Document.GetChildren()) - { - IDocument topicDocument = Outputs[nameof(Archives)][$"blog/topics/{post.GetString("topic")}/index.html"]; - string excerpt = post.GetString(Statiq.Html.HtmlKeys.Excerpt); -
-
-
@post.GetString("Title")
-
- @post.GetDateTime("Published").ToLongDateString() in - @topicDocument.GetTitle() -
- @if (!string.IsNullOrEmpty(excerpt)) - { - @Html.Raw(excerpt) -

Read more...

- } -
-
- } - @{ - IDocument older = Document.GetDocument(Keys.Next); - IDocument newer = Document.GetDocument(Keys.Previous); - } - @if (older != null || newer != null) - { -
-
- @if (older != null) - { - Older - } -
-
- @if (newer != null) - { - Newer - } -
-
- } -
\ No newline at end of file diff --git a/docs/input/appendix/borders.md b/docs/input/appendix/borders.md index 36b6b02a..0a83f135 100644 --- a/docs/input/appendix/borders.md +++ b/docs/input/appendix/borders.md @@ -1,5 +1,11 @@ Title: Borders Order: 2 +Description: "*Spectre.Console* makes it easy to create tables and panels with a variety of different styles of borders." +Highlights: + - Rounded + - Square + - Heavy + - And more... --- There is different built-in borders you can use for tables and panels. diff --git a/docs/input/appendix/colors.md b/docs/input/appendix/colors.md index 572bd80e..d8b81d24 100644 --- a/docs/input/appendix/colors.md +++ b/docs/input/appendix/colors.md @@ -1,5 +1,9 @@ Title: Colors Order: 0 +Description: "*Spectre.Console* allows easy rendering of the standard ANSI colors of your terminal, and also supports rendering up to 24-bit colors depending on the capabilities of your terminal." +Highlights: + - Predefined common colors + - Easy syntax for inline styling --- The following is a list of the standard 8-bit colors supported in terminals. diff --git a/docs/input/appendix/emojis.md b/docs/input/appendix/emojis.md index b70ea38e..fb770cfb 100644 --- a/docs/input/appendix/emojis.md +++ b/docs/input/appendix/emojis.md @@ -1,5 +1,9 @@ Title: Emojis Order: 3 +Description: "For terminals that support Emojis, *Spectre.Console* supports a simple syntax for rendering emojis." +Highlights: + - ":rocket: becomes ๐Ÿš€" + - ":waning_gibbous_moon: becomes ๐ŸŒ–" --- Please note that what emojis that can be used is completely up to diff --git a/docs/input/appendix/spinners.md b/docs/input/appendix/spinners.md index df50cd60..fb786e9f 100644 --- a/docs/input/appendix/spinners.md +++ b/docs/input/appendix/spinners.md @@ -1,5 +1,9 @@ Title: Spinners Order: 4 +Description: "*Spectre.Console* supports over 80 different types of spinners, and allows new ones to be defined. They are used automatically with the controls" +Highlights: + - Status display + - Progress display --- For all available spinners, see https://jsfiddle.net/sindresorhus/2eLtsbey/embedded/result/ diff --git a/docs/input/appendix/styles.md b/docs/input/appendix/styles.md index 913d2e57..c437eb71 100644 --- a/docs/input/appendix/styles.md +++ b/docs/input/appendix/styles.md @@ -1,5 +1,10 @@ Title: Styles Order: 1 +Description: "*Spectre.Console* makes it easy to write text with different styles beyond colors. Depending on your terminal, it can make it easy to use styles such as" +Highlights: + - Bold, Italic, Underline, strikethrough + - Dim, Invert + - Conceal, slowblink, rapidblink --- Note that what styles that can be used is defined by the system or your terminal software, and may not appear as they should. diff --git a/docs/input/blog/_category.yaml b/docs/input/blog/_category.yaml new file mode 100644 index 00000000..c3b0f844 --- /dev/null +++ b/docs/input/blog/_category.yaml @@ -0,0 +1,15 @@ +ArchiveSources: => $"blog/posts/**/*" +ArchiveKey: Category +ArchiveKeyComparer: => StringComparer.OrdinalIgnoreCase.ToConvertingEqualityComparer() +ArchiveDestination: > + => GetInt("Index") <= 1 ? $"blog/{NormalizedPath.OptimizeFileName(GetString("GroupKey"))}/index.html" : $"blog/{NormalizedPath.OptimizeFileName(GetString("GroupKey"))}/{GetInt("Index")}.html" +ArchivePageSize: => 5 +ArchiveOrderKey: published +ArchiveOrderDescending: true +Title: Categories +ArchiveTitle: => GetString("GroupKey") +# we only show if we have a group key which means we are a category and not the index and also +# if we are the first page +Hidden: > + => doc.GetString("GroupKey") != null && doc.GetInt("Index") <= 1 ? false : true +Order: 250 \ No newline at end of file diff --git a/docs/input/blog/_directory.yaml b/docs/input/blog/_directory.yaml new file mode 100644 index 00000000..a95e4b7a --- /dev/null +++ b/docs/input/blog/_directory.yaml @@ -0,0 +1,2 @@ +Hidden: true +Order: 1000 \ No newline at end of file diff --git a/docs/input/blog/_index.yaml b/docs/input/blog/_index.yaml new file mode 100644 index 00000000..14e305ba --- /dev/null +++ b/docs/input/blog/_index.yaml @@ -0,0 +1,10 @@ +Title: Recent Blog Posts +ArchiveSources: => $"blog/posts/**/*" +ArchiveDestination: > + => GetInt("Index") <= 1 ? $"blog/index.html" : $"blog/{GetInt("Index")}.html" +ArchivePageSize: => 5 +ArchiveOrderKey: Published +ArchiveOrderDescending: true +Hidden: > + => doc.GetInt("Index") == 1 ? false : true +Order: 25 diff --git a/docs/input/blog/_nextprevious.cshtml b/docs/input/blog/_nextprevious.cshtml new file mode 100644 index 00000000..8d3c159c --- /dev/null +++ b/docs/input/blog/_nextprevious.cshtml @@ -0,0 +1,27 @@ + +@inherits StatiqRazorPage +@model IDocument + +@{ + var older = Model.GetDocument(Keys.Next); + var newer = Model.GetDocument(Keys.Previous); +} + + +@if (older != null || newer != null) +{ +
+
+ @if (older != null) + { + Older + } +
+
+ @if (newer != null) + { + Newer + } +
+
+} \ No newline at end of file diff --git a/docs/input/blog/_posts.cshtml b/docs/input/blog/_posts.cshtml new file mode 100644 index 00000000..1456eba1 --- /dev/null +++ b/docs/input/blog/_posts.cshtml @@ -0,0 +1,33 @@ +@inherits StatiqRazorPage> +@foreach (var post in Model) +{ +
+

@post.GetString("Title")

+ @{ + var author = post.GetString("Author"); + var published = post.GetDateTime("Published"); + var category = post.GetString("Category"); + } +
+ Posted + @if (published != default(DateTime)) { + @published.ToLongDateString() + } + @if (author != null) { + by @author + } + @if (category != null) { + var categoryUrl = @Context.GetLink($"blog/{NormalizedPath.OptimizeFileName(category)}/index.html"); + + to + @category + + + } + +
+
+ @Html.Raw(@post.GetString("Excerpt")) +
+
+} \ No newline at end of file diff --git a/docs/input/blog/category.cshtml b/docs/input/blog/category.cshtml new file mode 100644 index 00000000..b55d853a --- /dev/null +++ b/docs/input/blog/category.cshtml @@ -0,0 +1,14 @@ +@inherits StatiqRazorPage +@if (Document.ContainsKey(Keys.GroupKey)) +{ + @Html.Partial("_posts.cshtml", Document.GetChildren()) + @Html.Partial("_nextprevious.cshtml", Document) +} +else +{ + @foreach (var tag in Document.GetChildren().OrderByDescending(x => x.GetChildren().Count())) + { + var postCount = tag.GetChildren().Count().ToString(); + @tag.GetTitle() (@postCount) + } +} \ No newline at end of file diff --git a/docs/input/blog/index.cshtml b/docs/input/blog/index.cshtml new file mode 100644 index 00000000..ee5f2fb4 --- /dev/null +++ b/docs/input/blog/index.cshtml @@ -0,0 +1,3 @@ +@inherits StatiqRazorPage +@Html.Partial("_posts.cshtml", Document.GetChildren()) +@Html.Partial("_nextprevious.cshtml", Document) diff --git a/docs/input/blog/posts/2021-07-11-hello-world.md b/docs/input/blog/posts/2021-07-11-hello-world.md new file mode 100644 index 00000000..1d272b3b --- /dev/null +++ b/docs/input/blog/posts/2021-07-11-hello-world.md @@ -0,0 +1,9 @@ +Title: Hello, World +Description: To help track new releases, updates and planning for Spectre.Console, we've added a new blog to the documentation. +Published: 20210711 +Category: News +--- + +To help track new releases, updates and planning for Spectre.Console, we've added a new blog to the documentation. + +Stay tuned for upcoming information related to the 0.41 release! \ No newline at end of file diff --git a/docs/input/blog/posts/BLOG_TEMPLATE.md b/docs/input/blog/posts/BLOG_TEMPLATE.md new file mode 100644 index 00000000..22fa788c --- /dev/null +++ b/docs/input/blog/posts/BLOG_TEMPLATE.md @@ -0,0 +1,19 @@ +Title: Short title, less than 50 characters +Description: Longer description, with optional *bold* and **italic** characters. Shouldn't be TOO long but can span multiple lines. +Published: 20210710 +Category: Release Notes | News | or whatever +Excluded: true +--- + +Intro paragraph, maybe even just the description. No need for a title that's included automatically. + +## Use second level headers + +Main title will be set with h1 + +## Tasks + +1. Set title and description +2. Set proper publish date +3. Set proper category +4. Remove excluded attribute. \ No newline at end of file diff --git a/docs/input/blog/posts/_ViewStart.cshtml b/docs/input/blog/posts/_ViewStart.cshtml new file mode 100644 index 00000000..451a0547 --- /dev/null +++ b/docs/input/blog/posts/_ViewStart.cshtml @@ -0,0 +1,3 @@ +@{ + Layout = @$"_layout.cshtml"; +} \ No newline at end of file diff --git a/docs/input/blog/posts/_layout.cshtml b/docs/input/blog/posts/_layout.cshtml new file mode 100644 index 00000000..4d23659d --- /dev/null +++ b/docs/input/blog/posts/_layout.cshtml @@ -0,0 +1,34 @@ +@{ + Layout = @"../../_layout.cshtml"; +} +@inherits StatiqRazorPage + +@{ + var author = Model.GetString("Author"); + var published = Model.GetDateTime("Published"); + var category = Model.GetString("Category"); +} + +@section subheading{ +
+ Posted + @if (published != default(DateTime)) { + @published.ToLongDateString() + } + @if (author != null) { + by @author + } + @if (category != null) { + + to + @category + + + } + +
+} + + + +@RenderBody() diff --git a/docs/input/cli/commandApp.md b/docs/input/cli/commandApp.md index 4c2e09d5..bf0919ff 100644 --- a/docs/input/cli/commandApp.md +++ b/docs/input/cli/commandApp.md @@ -1,5 +1,6 @@ Title: CommandApp Order: 2 +Description: "**CommandApp** is the entry point for a *Spectre.Console.Cli* command line application. It is used to configure the settings and commands used for execution of the application." --- `CommandApp` is the entry point for a `Spectre.Console.Cli` command line application. It is used to configure the settings and commands used for execution of the application. Most `Spectre.Console.Cli` applications will need to specify a custom configuration using the `Configure` method. diff --git a/docs/input/cli/commands.md b/docs/input/cli/commands.md index aa56a184..6abcc460 100644 --- a/docs/input/cli/commands.md +++ b/docs/input/cli/commands.md @@ -1,5 +1,6 @@ Title: Creating Commands Order: 6 +Description: "How to create commands for *Spectre.Console.Cli*" --- Commands in `Spectre.Console.Cli` are defined by creating a class that inherits from either `Spectre.Console.Cli.Command` or `Spectre.Console.Cli.AsyncCommand`. `Command` must implement an `Execute` method that returns an int where as `AsyncCommand` must implement `ExecuteAsync` returning `Task`. diff --git a/docs/input/cli/composing.md b/docs/input/cli/composing.md index 3e3a294d..7c548acd 100644 --- a/docs/input/cli/composing.md +++ b/docs/input/cli/composing.md @@ -1,6 +1,8 @@ Title: Composing Commands RedirectFrom: introduction Order: 8 +Description: "The underlying philosophy behind *Spectre.Console.Cli* is to rely on the .NET type system to +declare the commands, but tie everything together via composition." --- The underlying philosophy behind `Spectre.Console.Cli` is to rely on the .NET type system to diff --git a/docs/input/cli/getting-started.md b/docs/input/cli/getting-started.md index 68db8eb2..1f41be90 100644 --- a/docs/input/cli/getting-started.md +++ b/docs/input/cli/getting-started.md @@ -1,5 +1,6 @@ Title: Getting Started Order: 1 +Description: "How to get started using *Spectre.Console.Cli* to write a modern console application that follows industry conventions for command line parsing." --- `Spectre.Console.Cli` is a modern library for parsing command line arguments. While it's extremely diff --git a/docs/input/cli/index.cshtml b/docs/input/cli/index.cshtml index a35cdb63..51774595 100644 --- a/docs/input/cli/index.cshtml +++ b/docs/input/cli/index.cshtml @@ -1,5 +1,6 @@ Title: Spectre.Console.Cli -Order: 10 +Order: 80 +Description: "The command line interface for the *Spectre.Console* project." ---

Spectre.Console.Cli is a modern library for parsing command line arguments. While it's extremely opinionated in what it does, it tries to follow established industry conventions, and draws its inspiration from applications you use everyday.

diff --git a/docs/input/cli/introduction.md b/docs/input/cli/introduction.md index dd01aa3f..f081069a 100644 --- a/docs/input/cli/introduction.md +++ b/docs/input/cli/introduction.md @@ -1,5 +1,8 @@ Title: Introduction Order: 1 +Description: "*Spectre.Console.Cli* is a modern library for parsing command line arguments. While it's extremely +opinionated in what it does, it tries to follow established industry conventions, and draws +its inspiration from applications you use everyday." --- `Spectre.Console.Cli` is a modern library for parsing command line arguments. While it's extremely diff --git a/docs/input/cli/migration.md b/docs/input/cli/migration.md index e7a1e8c9..e7a07ff6 100644 --- a/docs/input/cli/migration.md +++ b/docs/input/cli/migration.md @@ -1,5 +1,6 @@ Title: Migrate from Spectre.Cli Order: 10 +Description: "Migrating from *Specte.Cli* to *Spectre.Console.Cli*" --- The functionality in `Spectre.Cli` has been moved into the `Spectre.Console` diff --git a/docs/input/cli/settings.md b/docs/input/cli/settings.md index aeb89d77..afb2514e 100644 --- a/docs/input/cli/settings.md +++ b/docs/input/cli/settings.md @@ -1,5 +1,6 @@ Title: Specifying Settings Order: 5 +Description: "How to define command line argument settings for your *Spectre.Console.Cli* Commands" --- Settings for `Spectre.Console.Cli` commands are defined via classes that inherit from `CommandSettings`. Attributes are used to indicate how the parser interprets the command line arguments and create a runtime instance of the settings to be used. diff --git a/docs/input/exceptions.md b/docs/input/exceptions.md index ce7cd048..5939e432 100644 --- a/docs/input/exceptions.md +++ b/docs/input/exceptions.md @@ -1,5 +1,9 @@ Title: Exceptions -Order: 3 +Order: 40 +Description: "Exceptions aren't always readable when viewed in the terminal. You can make exception a bit more readable by using the **WriteException** method." +Highlights: + - Color coded output. + - Shorten long identifiers and paths. --- Exceptions aren't always readable when viewed in the terminal. diff --git a/docs/input/index.md b/docs/input/index.md index 415c78fc..ee3d8af4 100644 --- a/docs/input/index.md +++ b/docs/input/index.md @@ -1,4 +1,5 @@ Title: Welcome +Description: Spectre.Console is a .NET Standard 2.0 library that makes it easier to create beautiful console applications. Order: 0 --- diff --git a/docs/input/live/index.cshtml b/docs/input/live/index.cshtml index ad7a0d72..906e949c 100644 --- a/docs/input/live/index.cshtml +++ b/docs/input/live/index.cshtml @@ -1,5 +1,6 @@ Title: Live -Order: 4 +Order: 50 +Description: Live displays continue to redraw their contents until an action is complete. --- Live displays continue to redraw their contents until an action is complete. diff --git a/docs/input/live/live-display.md b/docs/input/live/live-display.md index a3ba1494..53c4e990 100644 --- a/docs/input/live/live-display.md +++ b/docs/input/live/live-display.md @@ -1,5 +1,9 @@ Title: Live Display Order: 0 +Description: "*Spectre.Console* can update arbitrary widgets in-place." +Highlights: + - Update tables or graphs with new updates. + - Create a custom progress bar that extends the existing control. --- Spectre.Console can update arbitrary widgets in-place. diff --git a/docs/input/live/progress.md b/docs/input/live/progress.md index ed6a3355..0f27850f 100644 --- a/docs/input/live/progress.md +++ b/docs/input/live/progress.md @@ -1,6 +1,11 @@ Title: Progress Order: 5 RedirectFrom: progress +Description: "*Spectre.Console* can display information about long running tasks in the console using progress bars." +Highlights: + - Custom styling of progress bars. + - Multiple predefined columns such as Throughput, Estimated Time Remaining, and more. + - Fallback for non-interactive consoles such as CI runners. --- Spectre.Console can display information about long running tasks in the console. diff --git a/docs/input/live/status.md b/docs/input/live/status.md index fe2a9029..218c0796 100644 --- a/docs/input/live/status.md +++ b/docs/input/live/status.md @@ -1,6 +1,10 @@ Title: Status Order: 10 RedirectFrom: status +Description: "*Spectre.Console* can display information about long running tasks in the console with the Status control." +Highlights: + - Custom spinner control for running tasks. + - Fallback for non-interactive consoles such as CI runners. --- Spectre.Console can display information about long running tasks in the console. diff --git a/docs/input/markup.md b/docs/input/markup.md index ad01db35..53989ab5 100644 --- a/docs/input/markup.md +++ b/docs/input/markup.md @@ -1,5 +1,10 @@ Title: Markup -Order: 2 +Order: 30 +Description: The Markup class allows you to output rich text to the console. +Highlights: + - Easily add *color*. + - Add hyperlinks to for supported terminals. + - Emoji ๐Ÿš€ parsing. --- The `Markup` class allows you to output rich text to the console. diff --git a/docs/input/prompts/index.cshtml b/docs/input/prompts/index.cshtml index 3d4c7818..d4756e18 100644 --- a/docs/input/prompts/index.cshtml +++ b/docs/input/prompts/index.cshtml @@ -1,5 +1,6 @@ Title: Prompts -Order: 5 +Order: 60 +Description: "*Spectre.Console* has multiple controls to assist in user input." ---
    diff --git a/docs/input/prompts/multiselection.md b/docs/input/prompts/multiselection.md index ab600507..be35e5bc 100644 --- a/docs/input/prompts/multiselection.md +++ b/docs/input/prompts/multiselection.md @@ -1,5 +1,10 @@ Title: Multi Selection Order: 3 +Description: "The **MultiSelectionPrompt** can be used when you want the user to select one or many items from a provided list." +Highlights: + - Display multiple items for a user to scroll and choose from. + - Custom page sizes. + - Provide groups of selectable items. --- The `MultiSelectionPrompt` can be used when you want the user to select diff --git a/docs/input/prompts/selection.md b/docs/input/prompts/selection.md index bf5199bc..531670a8 100644 --- a/docs/input/prompts/selection.md +++ b/docs/input/prompts/selection.md @@ -1,5 +1,6 @@ Title: Selection Order: 1 +Description: "The **SelectionPrompt** can be used when you want the user to select a single item from a provided list." --- The `SelectionPrompt` can be used when you want the user to select diff --git a/docs/input/prompts/text.md b/docs/input/prompts/text.md index e55109a4..3bd6043b 100644 --- a/docs/input/prompts/text.md +++ b/docs/input/prompts/text.md @@ -1,6 +1,12 @@ Title: Text prompt Order: 0 RedirectFrom: prompt +Description: "*Spectre.Console* has multiple input functions for helping receive strongly typed input from a user." +Highlights: + - Confirmation. + - Strongly typed input. + - Input restricted to specific items. + - Secrets such as passwords or keys. --- Sometimes you want to get some input from the user, and for this diff --git a/docs/input/quick-start.md b/docs/input/quick-start.md index 73a08736..e7289d88 100644 --- a/docs/input/quick-start.md +++ b/docs/input/quick-start.md @@ -1,5 +1,6 @@ Title: Quick Start -Order: 1 +Order: 20 +Description: Getting started with *Spectre.Console* --- The fastest way of getting started using Spectre.Console is diff --git a/docs/input/sponsors.md b/docs/input/sponsors.md index ab16b3ac..1970d244 100644 --- a/docs/input/sponsors.md +++ b/docs/input/sponsors.md @@ -1,5 +1,6 @@ Title: Sponsors -Order: 0 +Order: 10 +Description: The longevity of *Spectre.Console* is thanks to the support of our sponsors. --- The following people are [sponsoring](https://github.com/sponsors/patriksvensson) diff --git a/docs/input/widgets/barchart.md b/docs/input/widgets/barchart.md index 63195022..d1de4cdb 100644 --- a/docs/input/widgets/barchart.md +++ b/docs/input/widgets/barchart.md @@ -1,5 +1,10 @@ Title: Bar Chart Order: 20 +Description: "Use **BarChart** to render bar charts to the console." +Highlights: + - Custom colors + - Labels + - Use your own data with a converter. --- Use `BarChart` to render bar charts to the console. diff --git a/docs/input/widgets/calendar.md b/docs/input/widgets/calendar.md index e509c245..7decf7cd 100644 --- a/docs/input/widgets/calendar.md +++ b/docs/input/widgets/calendar.md @@ -1,6 +1,11 @@ ๏ปฟTitle: Calendar Order: 40 RedirectFrom: calendar +Description: "The **Calendar** is used to render a calendar to the terminal." +Highlights: + - Include highlighted events. + - Culture aware. + - Custom headers. --- The `Calendar` is used to render a calendar to the terminal. diff --git a/docs/input/widgets/canvas-image.md b/docs/input/widgets/canvas-image.md index 3db9f9a7..cde98997 100644 --- a/docs/input/widgets/canvas-image.md +++ b/docs/input/widgets/canvas-image.md @@ -1,5 +1,6 @@ Title: Canvas Image Order: 70 +Description: "Use *ImageSharp* to parse images and render them as Ascii art to the console." --- To add [ImageSharp](https://github.com/SixLabors/ImageSharp) superpowers to diff --git a/docs/input/widgets/canvas.md b/docs/input/widgets/canvas.md index 5c80f2a3..ee11548e 100644 --- a/docs/input/widgets/canvas.md +++ b/docs/input/widgets/canvas.md @@ -1,5 +1,6 @@ Title: Canvas Order: 60 +Description: "**Canvas** is a widget that allows you to render arbitrary pixels to the console." --- `Canvas` is a widget that allows you to render arbitrary "pixels" diff --git a/docs/input/widgets/figlet.md b/docs/input/widgets/figlet.md index 345540e4..c8fc881f 100644 --- a/docs/input/widgets/figlet.md +++ b/docs/input/widgets/figlet.md @@ -1,6 +1,7 @@ Title: Figlet Order: 50 RedirectFrom: figlet +Description: "*Spectre.Console* can render FIGlet text by using the **FigletText** class." --- Spectre.Console can render [FIGlet](http://www.figlet.org/) text by using the `FigletText` class. diff --git a/docs/input/widgets/index.cshtml b/docs/input/widgets/index.cshtml index 3ba79f1f..524423fb 100644 --- a/docs/input/widgets/index.cshtml +++ b/docs/input/widgets/index.cshtml @@ -1,5 +1,6 @@ Title: Widgets -Order: 9 +Order: 70 +Description: "*Spectre.Console* supports many built-in widgets to help render beautiful output." ---
      diff --git a/docs/input/widgets/rule.md b/docs/input/widgets/rule.md index 6b9eef93..49edae88 100644 --- a/docs/input/widgets/rule.md +++ b/docs/input/widgets/rule.md @@ -1,6 +1,11 @@ Title: Rule Order: 30 RedirectFrom: rule +Description: "The **Rule** class is used to render a horizontal rule (line) to the terminal." +Highlights: + - Custom colors for line and title. + - Specify left, center or right aligned title. + --- The `Rule` class is used to render a horizontal rule (line) to the terminal. diff --git a/docs/input/widgets/table.md b/docs/input/widgets/table.md index cf646c22..2481dcdb 100644 --- a/docs/input/widgets/table.md +++ b/docs/input/widgets/table.md @@ -1,6 +1,7 @@ Title: Table Order: 0 RedirectFrom: tables +Description: "Tables are a perfect way of displaying tabular data in a terminal. *Spectre.Console* is super smart about rendering tables and will adjust all columns to fit whatever is inside them." --- Tables are a perfect way of displaying tabular data in a terminal. diff --git a/docs/input/widgets/tree.md b/docs/input/widgets/tree.md index 0b86b2ee..0fab485e 100644 --- a/docs/input/widgets/tree.md +++ b/docs/input/widgets/tree.md @@ -1,5 +1,9 @@ Title: Tree Order: 10 +Description: "The **Tree** widget can be used to render hierarchical data." +Highlights: + - Custom colors and styles for guidelines. + - Include any *Spectre.Console* widgets as child nodes. --- The `Tree` widget can be used to render hierarchical data. diff --git a/docs/package-lock.json b/docs/package-lock.json index 4b253936..9d269dff 100644 --- a/docs/package-lock.json +++ b/docs/package-lock.json @@ -138,12 +138,29 @@ "lodash.uniq": "^4.5.0" } }, + "@types/node": { + "version": "16.3.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.3.1.tgz", + "integrity": "sha512-N87VuQi7HEeRJkhzovao/JviiqKjDKMVKxKMfUvSKw+MbkbW8R0nA3fi/MQhhlxV2fQ+2ReM+/Nt4efdrJx3zA==", + "dev": true, + "optional": true + }, "@types/parse-json": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz", "integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==", "dev": true }, + "@types/yauzl": { + "version": "2.9.2", + "resolved": "https://registry.npmjs.org/@types/yauzl/-/yauzl-2.9.2.tgz", + "integrity": "sha512-8uALY5LTvSuHgloDVUvWP3pIauILm+8/0pDMokuDYIoNsOkSwd5AiHBTSEJjKTDcZr5z8UpgOWZkxBF4iJftoA==", + "dev": true, + "optional": true, + "requires": { + "@types/node": "*" + } + }, "acorn": { "version": "7.4.1", "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.4.1.tgz", @@ -167,6 +184,15 @@ "integrity": "sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA==", "dev": true }, + "agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "dev": true, + "requires": { + "debug": "4" + } + }, "ansi-regex": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", @@ -262,6 +288,12 @@ "node-releases": "^1.1.71" } }, + "buffer-crc32": { + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", + "integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI=", + "dev": true + }, "bytes": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.0.tgz", @@ -438,6 +470,15 @@ "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", "dev": true }, + "debug": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, "defined": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/defined/-/defined-1.0.0.tgz", @@ -494,6 +535,15 @@ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dev": true }, + "end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "dev": true, + "requires": { + "once": "^1.4.0" + } + }, "error-ex": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", @@ -523,6 +573,18 @@ "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", "dev": true }, + "extract-zip": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extract-zip/-/extract-zip-2.0.1.tgz", + "integrity": "sha512-GDhU9ntwuKyGXdZBUgTIe+vXnWj0fppUEtMDL0+idd5Sta8TGpHssn/eusA9mrPr9qNDym6SxAYZjNvCn/9RBg==", + "dev": true, + "requires": { + "@types/yauzl": "^2.9.1", + "debug": "^4.1.1", + "get-stream": "^5.1.0", + "yauzl": "^2.10.0" + } + }, "fast-glob": { "version": "3.2.5", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.5.tgz", @@ -546,6 +608,15 @@ "reusify": "^1.0.4" } }, + "fd-slicer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", + "integrity": "sha1-JcfInLH5B3+IkbvmHY85Dq4lbx4=", + "dev": true, + "requires": { + "pend": "~1.2.0" + } + }, "fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -604,6 +675,15 @@ "integrity": "sha512-sY22aA6xchAzprjyqmSEQv4UbAAzRN0L2dQB0NlN5acTTK9Don6nhoc3eAbUnpZiCANAMfd/+40kVdKfFygohg==", "dev": true }, + "get-stream": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", + "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", + "dev": true, + "requires": { + "pump": "^3.0.0" + } + }, "glob": { "version": "7.1.6", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", @@ -704,6 +784,16 @@ "integrity": "sha512-1qYz89hW3lFDEazhjW0yVAV87lw8lVkrJocr72XmBkMKsoSVJCQx3W8BXsC7hO2qAt8BoVjYjtAcZ9perqGnNg==", "dev": true }, + "https-proxy-agent": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz", + "integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==", + "dev": true, + "requires": { + "agent-base": "6", + "debug": "4" + } + }, "ignore": { "version": "5.1.8", "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz", @@ -825,6 +915,12 @@ "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", "dev": true }, + "jpeg-js": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/jpeg-js/-/jpeg-js-0.4.3.tgz", + "integrity": "sha512-ru1HWKek8octvUHFHvE5ZzQ1yAsJmIvRdGWvSoKV52XKyuyYA437QWDttXT8eZXDSbuMpHlLzPDZUPd6idIz+Q==", + "dev": true + }, "js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -941,6 +1037,12 @@ "picomatch": "^2.2.3" } }, + "mime": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/mime/-/mime-2.5.2.tgz", + "integrity": "sha512-tqkh47FzKeCPD2PUiPB6pkbMzsCasjxAfC62/Wap5qrUWcb+sFasXUC5I3gYM5iBM8v/Qpn4UK0x+j0iHyFPDg==", + "dev": true + }, "mini-svg-data-uri": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/mini-svg-data-uri/-/mini-svg-data-uri-1.2.3.tgz", @@ -968,6 +1070,12 @@ "integrity": "sha512-1lM+BMLGuDfsdwf3rsgBSrxJwAZHFIrQ8YR61xIqdHo0uNKI9M52wNpHSrliZATJp51On6JD0AfRxd4YGSU0lw==", "dev": true }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, "nanoid": { "version": "3.1.22", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.22.tgz", @@ -1096,6 +1204,12 @@ "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", "dev": true }, + "pend": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", + "integrity": "sha1-elfrVQpng/kRUzH89GY9XI4AelA=", + "dev": true + }, "picomatch": { "version": "2.2.3", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.2.3.tgz", @@ -1108,6 +1222,34 @@ "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "dev": true }, + "playwright": { + "version": "1.12.3", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.12.3.tgz", + "integrity": "sha512-eyhHvZV7dMAUltqjQsgJ9CjZM8dznzN1+rcfCI6W6lfQ7IlPvTFGLuKOCcI4ETbjfbxqaS5FKIkb1WDDzq2Nww==", + "dev": true, + "requires": { + "commander": "^6.1.0", + "debug": "^4.1.1", + "extract-zip": "^2.0.1", + "https-proxy-agent": "^5.0.0", + "jpeg-js": "^0.4.2", + "mime": "^2.4.6", + "pngjs": "^5.0.0", + "progress": "^2.0.3", + "proper-lockfile": "^4.1.1", + "proxy-from-env": "^1.1.0", + "rimraf": "^3.0.2", + "stack-utils": "^2.0.3", + "ws": "^7.4.6", + "yazl": "^2.5.1" + } + }, + "pngjs": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/pngjs/-/pngjs-5.0.0.tgz", + "integrity": "sha512-40QW5YalBNfQo5yRYmiw7Yz6TKKVr3h6970B2YE+3fQpsWcrbj1PzJgxeJ19DRQjhMbKPIuMY8rFaXc8moolVw==", + "dev": true + }, "postcss": { "version": "8.2.10", "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.2.10.tgz", @@ -1285,6 +1427,39 @@ "integrity": "sha1-t+PqQkNaTJsnWdmeDyAesZWALuE=", "dev": true }, + "progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "dev": true + }, + "proper-lockfile": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/proper-lockfile/-/proper-lockfile-4.1.2.tgz", + "integrity": "sha512-TjNPblN4BwAWMXU8s9AEz4JmQxnD1NNL7bNOY/AKUzyamc379FWASUhc/K1pL2noVb+XmZKLL68cjzLsiOAMaA==", + "dev": true, + "requires": { + "graceful-fs": "^4.2.4", + "retry": "^0.12.0", + "signal-exit": "^3.0.2" + } + }, + "proxy-from-env": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", + "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==", + "dev": true + }, + "pump": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", + "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "dev": true, + "requires": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, "purgecss": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/purgecss/-/purgecss-3.1.3.tgz", @@ -1367,12 +1542,27 @@ "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", "dev": true }, + "retry": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", + "integrity": "sha1-G0KmJmoh8HQh0bC1S33BZ7AcATs=", + "dev": true + }, "reusify": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", "dev": true }, + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, "run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", @@ -1397,6 +1587,12 @@ "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", "dev": true }, + "signal-exit": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", + "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==", + "dev": true + }, "simple-swizzle": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz", @@ -1418,6 +1614,23 @@ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "dev": true }, + "stack-utils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.3.tgz", + "integrity": "sha512-gL//fkxfWUsIlFL2Tl42Cl6+HFALEaB1FU76I/Fy+oZjRreP7OPMXFlGbxM7NQsI0ZpUfw76sHnv0WNYuTb7Iw==", + "dev": true, + "requires": { + "escape-string-regexp": "^2.0.0" + }, + "dependencies": { + "escape-string-regexp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", + "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", + "dev": true + } + } + }, "string-width": { "version": "4.2.2", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", @@ -1529,6 +1742,12 @@ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true }, + "ws": { + "version": "7.5.2", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.2.tgz", + "integrity": "sha512-lkF7AWRicoB9mAgjeKbGqVUekLnSNO4VjKVnuPHpQeOxZOErX6BPXwJk70nFslRCEEA8EVW7ZjKwXaP9N+1sKQ==", + "dev": true + }, "xtend": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", @@ -1567,6 +1786,25 @@ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.7.tgz", "integrity": "sha512-FiNkvbeHzB/syOjIUxFDCnhSfzAL8R5vs40MgLFBorXACCOAEaWu0gRZl14vG8MR9AOJIZbmkjhusqBYZ3HTHw==", "dev": true + }, + "yauzl": { + "version": "2.10.0", + "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", + "integrity": "sha1-x+sXyT4RLLEIb6bY5R+wZnt5pfk=", + "dev": true, + "requires": { + "buffer-crc32": "~0.2.3", + "fd-slicer": "~1.1.0" + } + }, + "yazl": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/yazl/-/yazl-2.5.1.tgz", + "integrity": "sha512-phENi2PLiHnHb6QBVot+dJnaAZ0xosj7p3fWl+znIjBDlnMI2PsZCJZ306BPTFOaHf5qdDEI8x5qFrSOBN5vrw==", + "dev": true, + "requires": { + "buffer-crc32": "~0.2.3" + } } } } diff --git a/docs/package.json b/docs/package.json index bbe7b1fb..fb643a77 100644 --- a/docs/package.json +++ b/docs/package.json @@ -16,6 +16,7 @@ "@tailwindcss/typography": "^0.4.0", "autoprefixer": "^10.2.5", "cross-env": "^7.0.3", + "playwright": "^1.12.3", "postcss": "^8.2.10", "postcss-cli": "^8.3.1", "tailwindcss": "^2.1.1" diff --git a/docs/src/Pipelines/SocialCardPipeline.cs b/docs/src/Pipelines/SocialCardPipeline.cs new file mode 100644 index 00000000..85a11b1f --- /dev/null +++ b/docs/src/Pipelines/SocialCardPipeline.cs @@ -0,0 +1,113 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Builder; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.FileProviders; +using Microsoft.Extensions.Logging; +using Microsoft.Playwright; +using Statiq.Common; +using Statiq.Core; +using Statiq.Web; +using Statiq.Web.Modules; +using Statiq.Web.Pipelines; + +namespace Docs.Pipelines +{ + public class SocialImages : Pipeline + { + public SocialImages() + { + Dependencies.AddRange(nameof(Inputs)); + + ProcessModules = new ModuleList + { + new GetPipelineDocuments(ContentType.Content), + + // Filter to non-archive content + new FilterDocuments(Config.FromDocument(doc => !Archives.IsArchive(doc))), + + // Process the content + new CacheDocuments + { + new AddTitle(), + new SetDestination(true), + new ExecuteIf(Config.FromSetting(WebKeys.OptimizeContentFileNames, true)) + { + new OptimizeFileName() + }, + new GenerateSocialImage(), + } + }; + + OutputModules = new ModuleList { new WriteFiles() }; + } + } + + class GenerateSocialImage : ParallelModule + { + private IPlaywright _playwright; + private IBrowser _browser; + private WebApplication _app; + + protected override async Task BeforeExecutionAsync(IExecutionContext context) + { + var builder = WebApplication.CreateBuilder(); + builder.Logging.ClearProviders(); + + builder.Services + .AddRazorPages() + .WithRazorPagesRoot("/src/SocialCards/"); + + _app = builder.Build(); + _app.MapRazorPages(); + _app.UseStaticFiles(new StaticFileOptions + { + FileProvider = new PhysicalFileProvider( + Path.Combine(builder.Environment.ContentRootPath, "src/SocialCards")), + RequestPath = "/static" + }); + + await _app.StartAsync().ConfigureAwait(false); + + _playwright = await Playwright.CreateAsync().ConfigureAwait(false); + _browser = await _playwright.Chromium.LaunchAsync().ConfigureAwait(false); + } + + protected override async Task FinallyAsync(IExecutionContext context) + { + await _browser.DisposeAsync().ConfigureAwait(false); + _playwright.Dispose(); + await _app.DisposeAsync().ConfigureAwait(false); + await base.FinallyAsync(context); + } + + protected override async Task> ExecuteInputAsync(IDocument input, IExecutionContext context) + { + var url = _app.Urls.FirstOrDefault(u => u.StartsWith("http://")); + var page = await _browser.NewPageAsync(new BrowserNewPageOptions + { + ViewportSize = new ViewportSize { Width = 1200, Height = 618 }, + } + ); + + var title = input.GetString("Title"); + var description = input.GetString("Description"); + var highlights = input.GetList("Highlights") ?? Array.Empty(); + + await page.GotoAsync($"{url}/?title={title}&desc={description}&highlights={string.Join("||", highlights)}"); + var bytes = await page.ScreenshotAsync(); + + var destination = input.Destination.InsertSuffix("-social").ChangeExtension("png"); + var doc = context.CreateDocument( + input.Source, + destination, + new MetadataItems { { "DocId", input.Id }}, + context.GetContentProvider(bytes)); + + return new[] { doc }; + } + } +} \ No newline at end of file diff --git a/docs/src/SocialCards/CascadiaCodePL.woff2 b/docs/src/SocialCards/CascadiaCodePL.woff2 new file mode 100644 index 00000000..cff711dc Binary files /dev/null and b/docs/src/SocialCards/CascadiaCodePL.woff2 differ diff --git a/docs/src/SocialCards/index.cshtml b/docs/src/SocialCards/index.cshtml new file mode 100644 index 00000000..c8511905 --- /dev/null +++ b/docs/src/SocialCards/index.cshtml @@ -0,0 +1,120 @@ +@page +@using Markdig +@model Docs.SocialCards.SocialCardModel + +@{ + Layout = null; +} + + + + + + + +
      +
      +
      โ•ญโ”€ ~/spectre.console .NET 5.0  main
      +
      โ•ฐโ”€ dotnet run
      +
      +
      โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
      +
      โ”‚ โ”‚
      +
      โ”‚ โ”‚
      +
      โ”‚ โ”‚
      +
      โ”‚ โ”‚
      +
      โ”‚ โ”‚
      +
      โ”‚ โ”‚
      +
      โ”‚ โ”‚
      +
      โ”‚ โ”‚
      +
      โ”‚ โ”‚
      +
      โ”‚ โ”‚
      +
      โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
      + +
      @Model.Title
      +
      + @if (string.IsNullOrWhiteSpace(Model.Description) == false) + { +

      @Html.Raw(Markdown.ToHtml(Model.Description))

      + } + @if (string.IsNullOrWhiteSpace(Model.Highlights) == false) + { +
        + @foreach (var highlight in Model.Highlights.Split("||")) + { +
      • @Html.Raw(Markdown.ToHtml(highlight))
      • + } +
      + } + @if (string.IsNullOrWhiteSpace(Model.Footer) == false) + { + + } +
      + +
      + +
      + + \ No newline at end of file diff --git a/docs/src/SocialCards/index.cshtml.cs b/docs/src/SocialCards/index.cshtml.cs new file mode 100644 index 00000000..d7ceac1c --- /dev/null +++ b/docs/src/SocialCards/index.cshtml.cs @@ -0,0 +1,31 @@ +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.RazorPages; +using Microsoft.Extensions.Logging; + +namespace Docs.SocialCards{ + public class SocialCardModel : PageModel + { + [BindProperty(Name = "title", SupportsGet = true)] + public string Title { get; set; } + + [BindProperty(Name = "desc", SupportsGet = true)] + public string Description { get; set; } + + [BindProperty(Name = "highlights", SupportsGet = true)] + public string Highlights { get; set; } + + [BindProperty(Name = "footer", SupportsGet = true)] + public string Footer { get; set; } + + private readonly ILogger _logger; + + public SocialCardModel(ILogger logger) + { + _logger = logger; + } + + public void OnGet() + { + } + } +} \ No newline at end of file diff --git a/docs/src/SocialCards/styles.css b/docs/src/SocialCards/styles.css new file mode 100644 index 00000000..a33c6029 --- /dev/null +++ b/docs/src/SocialCards/styles.css @@ -0,0 +1,148 @@ +๏ปฟ@font-face { + font-family: 'CascadiaCodePL'; + src: url('CascadiaCodePL.woff2') format('woff2'); +} + +* { + padding:0; + margin:0; + } + + :root { + --height: 618px; + --width:1200px; + --line-height: 39px; + --padding: 20px; + --rows: calc((--var(--height) - var(--padding) * 2) / var(--line-height)); + --background: #1E2127; + --black: #000000; + --blue: #61AFEF; + --brightBlack: #5C6370; + --brightBlue: #61AFEF; + --brightCyan: #56B6C2; + --brightGreen: #98C379; + --brightPurple: #C678DD; + --brightRed: #E06C75; + --brightWhite: #FFFFFF; + --brightYellow: #D19A66; + --cyan: #56B6C2; + --foreground: #5C6370; + --green: #98C379; + --purple: #C678DD; + --red: #E06C75; + --white: #ABB2BF; + --yellow: #D19A66; + --folder: var(--yellow); + --dotnet: var(--blue); + --git: var(--green); + } + + + body{ + font-family:'CascadiaCodePL',monospace; + font-weight:400; + font-size: calc(var(--line-height) - 5px); + } + + #container { + background-color: var(--background); + color: #fff; + width: calc(var(--width) - var(--padding) * 2); + height: calc(var(--height) - var(--padding) * 2); + padding:var(--padding); + position: relative; + } + + #console{ + position: relative; + } + + .line{ + height:var(--line-height); + width:100%; + white-space: pre; + } + + #title{ + position: absolute; + left: 3ch; + top: calc(3 * var(--line-height)); + margin: 0 -3px; + padding: 0 3px; + background:var(--background); + z-index:4; + } + + #content{ + position: absolute; + left: 3ch; + top: calc(5 * var(--line-height));; + height:calc(var(--height) - 7 * var(--line-height)); + width: 53ch; + line-height:var(--line-height); + overflow-y: hidden; + } + + #content p { + margin: 0; + } + + #content p + ul { + margin-top:var(--line-height); + } + + #content strong { + color: var(--yellow); + font-weight: 400; + } + + #content em, #content i { + color: var(--blue); + font-style: normal; + } + + #content ul { + list-style: "*"; + margin-left: 1ch; + } + + #content ul li { + padding-left:1ch; + } + + + + #footer{ + position: absolute; + top: calc(var(--height) - var(--padding) - var(--line-height) * 3); + left : 3ch; + background:var(--background); + width:51ch; + z-index:4; + } + + #logo{ + height:calc(var(--line-height) * 2.5); + width:calc(var(--line-height) * 2.5); + position:absolute; + right:2ch; + top:calc(var(--padding) / 2); + fill: var(--white); + opacity:.4; + } + + #container::before { + /* fake scan lines */ + content: " "; + display: block; + position: absolute; + top: 0; + left: 0; + bottom: 0; + right: 0; + background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06)); + z-index: 200; + background-size: 100% 4px, 5px 100%; + pointer-events: none; + } +