mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-04-16 00:42:51 +08:00
Fix outdated documentation
This commit is contained in:
parent
03334f693d
commit
10daf727e9
@ -31,8 +31,8 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Statiq.Web" Version="1.0.0-beta.5" />
|
||||
<PackageReference Include="MinVer" PrivateAssets="All" Version="2.3.0" />
|
||||
<PackageReference Include="Statiq.Web" Version="1.0.0-beta.11" />
|
||||
<PackageReference Include="MinVer" PrivateAssets="All" Version="2.3.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 1.3 MiB After Width: | Height: | Size: 1.4 MiB |
@ -36,15 +36,15 @@ AnsiConsole.WriteException(ex, new ExceptionSettings
|
||||
Format = ExceptionFormats.ShortenEverything | ExceptionFormats.ShowLinks,
|
||||
Style = new ExceptionStyle
|
||||
{
|
||||
Exception = Style.WithForeground(Color.Grey),
|
||||
Message = Style.WithForeground(Color.White),
|
||||
NonEmphasized = Style.WithForeground(Color.Cornsilk1),
|
||||
Parenthesis = Style.WithForeground(Color.Cornsilk1),
|
||||
Method = Style.WithForeground(Color.Red),
|
||||
ParameterName = Style.WithForeground(Color.Cornsilk1),
|
||||
ParameterType = Style.WithForeground(Color.Red),
|
||||
Path = Style.WithForeground(Color.Red),
|
||||
LineNumber = Style.WithForeground(Color.Cornsilk1),
|
||||
Exception = new Style().Foreground(Color.Grey),
|
||||
Message = new Style().Foreground(Color.White),
|
||||
NonEmphasized = new Style().Foreground(Color.Cornsilk1),
|
||||
Parenthesis = new Style().Foreground(Color.Cornsilk1),
|
||||
Method = new Style().Foreground(Color.Red),
|
||||
ParameterName = new Style().Foreground(Color.Cornsilk1),
|
||||
ParameterType = new Style().Foreground(Color.Red),
|
||||
Path = new Style().Foreground(Color.Red),
|
||||
LineNumber = new Style().Foreground(Color.Cornsilk1),
|
||||
}
|
||||
});
|
||||
```
|
||||
|
@ -1,4 +1,4 @@
|
||||
Title: Welcome
|
||||
Title: Welcome
|
||||
Order: 0
|
||||
---
|
||||
|
||||
|
@ -43,10 +43,10 @@ AnsiConsole.Markup("[[Hello]] "); // [Hello]
|
||||
AnsiConsole.Markup("[red][[World]][/]"); // [World]
|
||||
```
|
||||
|
||||
You can also use the `SafeMarkup` extension method.
|
||||
You can also use the `EscapeMarkup` extension method.
|
||||
|
||||
```csharp
|
||||
AnsiConsole.Markup("[red]{0}[/]", "Hello [World]".SafeMarkup());
|
||||
AnsiConsole.Markup("[red]{0}[/]", "Hello [World]".EscapeMarkup());
|
||||
```
|
||||
|
||||
# Setting background color
|
||||
@ -64,7 +64,7 @@ You can set the background color in markup by prefixing the color with
|
||||
To output an emoji as part of markup, you can use emoji shortcodes.
|
||||
|
||||
```csharp
|
||||
AnsiConsole.MarkupLine("Hello :globe_showing_europe_africa:!");
|
||||
AnsiConsole.Markup("Hello :globe_showing_europe_africa:!");
|
||||
```
|
||||
|
||||
For a list of emoji, see the [Emojis](xref:emojis) appendix section.
|
||||
|
@ -1,4 +1,4 @@
|
||||
Title: Calendar
|
||||
Title: Calendar
|
||||
Order: 4
|
||||
RedirectFrom: calendar
|
||||
---
|
||||
@ -12,7 +12,9 @@ To render a calendar, create a `Calendar` instance with a target date.
|
||||
```csharp
|
||||
var calendar = new Calendar(2020,10);
|
||||
AnsiConsole.Render(calendar);
|
||||
```
|
||||
|
||||
```text
|
||||
2020 October
|
||||
┌─────┬─────┬─────┬─────┬─────┬─────┬─────┐
|
||||
│ Sun │ Mon │ Tue │ Wed │ Thu │ Fri │ Sat │
|
||||
@ -32,20 +34,22 @@ You can set the calendar's culture to show localized weekdays.
|
||||
|
||||
```csharp
|
||||
var calendar = new Calendar(2020,10);
|
||||
calendar.SetCulture("ja-JP");
|
||||
calendar.Culture("ja-JP");
|
||||
AnsiConsole.Render(calendar);
|
||||
```
|
||||
|
||||
2020年10月
|
||||
┌────┬────┬────┬────┬────┬────┬────┐
|
||||
│ 日 │ 月 │ 火 │ 水 │ 木 │ 金 │ 土 │
|
||||
├────┼────┼────┼────┼────┼────┼────┤
|
||||
│ │ │ │ │ 1 │ 2 │ 3 │
|
||||
│ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 10 │
|
||||
│ 11 │ 12 │ 13 │ 14 │ 15 │ 16 │ 17 │
|
||||
│ 18 │ 19 │ 20 │ 21 │ 22 │ 23 │ 24 │
|
||||
│ 25 │ 26 │ 27 │ 28 │ 29 │ 30 │ 31 │
|
||||
│ │ │ │ │ │ │ │
|
||||
└────┴────┴────┴────┴────┴────┴────┘
|
||||
```text
|
||||
Oktober 2020
|
||||
┌─────┬─────┬─────┬─────┬─────┬─────┬─────┐
|
||||
│ Mån │ Tis │ Ons │ Tor │ Fre │ Lör │ Sön │
|
||||
├─────┼─────┼─────┼─────┼─────┼─────┼─────┤
|
||||
│ │ │ │ 1 │ 2 │ 3 │ 4 │
|
||||
│ 5 │ 6 │ 7 │ 8 │ 9 │ 10 │ 11* │
|
||||
│ 12 │ 13 │ 14 │ 15 │ 16 │ 17 │ 18 │
|
||||
│ 19 │ 20 │ 21 │ 22 │ 23 │ 24 │ 25 │
|
||||
│ 26 │ 27 │ 28 │ 29 │ 30 │ 31 │ │
|
||||
│ │ │ │ │ │ │ │
|
||||
└─────┴─────┴─────┴─────┴─────┴─────┴─────┘
|
||||
```
|
||||
|
||||
## Header
|
||||
@ -56,7 +60,9 @@ You can hide the calendar header.
|
||||
var calendar = new Calendar(2020,10);
|
||||
calendar.ShowHeader = false;
|
||||
AnsiConsole.Render(calendar);
|
||||
```
|
||||
|
||||
```text
|
||||
┌─────┬─────┬─────┬─────┬─────┬─────┬─────┐
|
||||
│ Sun │ Mon │ Tue │ Wed │ Thu │ Fri │ Sat │
|
||||
├─────┼─────┼─────┼─────┼─────┼─────┼─────┤
|
||||
@ -72,13 +78,13 @@ AnsiConsole.Render(calendar);
|
||||
You can set the header style of the calendar.
|
||||
|
||||
```csharp
|
||||
var calendar = new Calendar(2020,10);
|
||||
calendar.SetHeaderStyle(Style.Parse("blue bold"));
|
||||
var calendar = new Calendar(2020, 10);
|
||||
calendar.HeaderStyle(Style.Parse("blue bold"));
|
||||
AnsiConsole.Render(calendar);
|
||||
```
|
||||
|
||||
|
||||
## Calendar Event
|
||||
## Calendar Events
|
||||
|
||||
You can add an event to the calendar.
|
||||
If a date has an event associated with it, the date gets highlighted in the calendar.
|
||||
@ -87,7 +93,9 @@ If a date has an event associated with it, the date gets highlighted in the cale
|
||||
var calendar = new Calendar(2020,10);
|
||||
calendar.AddCalendarEvent(2020, 10, 11);
|
||||
AnsiConsole.Render(calendar);
|
||||
```
|
||||
|
||||
```text
|
||||
2020 October
|
||||
┌─────┬─────┬─────┬─────┬─────┬─────┬─────┐
|
||||
│ Sun │ Mon │ Tue │ Wed │ Thu │ Fri │ Sat │
|
||||
@ -106,9 +114,8 @@ AnsiConsole.Render(calendar);
|
||||
You can set the highlight style for a calendar event via `SetHighlightStyle`.
|
||||
|
||||
```csharp
|
||||
var calendar = new Calendar(2020,10);
|
||||
var calendar = new Calendar(2020, 10);
|
||||
calendar.AddCalendarEvent(2020, 10, 11);
|
||||
calendar.SetHighlightStyle(Style.Parse("yellow bold"));
|
||||
calendar.HighlightStyle(Style.Parse("yellow bold"));
|
||||
AnsiConsole.Render(calendar);
|
||||
|
||||
```
|
||||
|
@ -1,4 +1,4 @@
|
||||
Title: Rule
|
||||
Title: Rule
|
||||
Order: 5
|
||||
RedirectFrom: rule
|
||||
---
|
||||
@ -23,8 +23,9 @@ You can set the rule title markup text.
|
||||
```csharp
|
||||
var rule = new Rule("[red]Hello[/]");
|
||||
AnsiConsole.Render(rule);
|
||||
```
|
||||
|
||||
// output
|
||||
```text
|
||||
───────────────────────────────── Hello ─────────────────────────────────
|
||||
```
|
||||
|
||||
@ -36,36 +37,36 @@ You can set the rule's title alignment.
|
||||
var rule = new Rule("[red]Hello[/]");
|
||||
rule.Alignment = Justify.Left;
|
||||
AnsiConsole.Render(rule);
|
||||
```
|
||||
|
||||
//output
|
||||
```text
|
||||
── Hello ────────────────────────────────────────────────────────────────
|
||||
```
|
||||
|
||||
You can also specify it with a method
|
||||
You can also specify it via an extension method:
|
||||
|
||||
```csharp
|
||||
var rule = new Rule("[red]Hello[/]");
|
||||
rule.LeftAligned();
|
||||
AnsiConsole.Render(rule);
|
||||
```
|
||||
|
||||
//output
|
||||
```text
|
||||
── Hello ────────────────────────────────────────────────────────────────
|
||||
```
|
||||
|
||||
|
||||
## Style
|
||||
|
||||
You can set the rule style.
|
||||
## Styling
|
||||
|
||||
```csharp
|
||||
var rule = new Rule("[red]Hello[/]");
|
||||
rule.Style = Style.Parse("red dim");
|
||||
AnsiConsole.Render(rule);
|
||||
```
|
||||
You can also specify it with a method
|
||||
You can also specify it via an extension method
|
||||
|
||||
```csharp
|
||||
var rule = new Rule("[red]Hello[/]");
|
||||
rule.SetStyle("red dim");
|
||||
rule.RuleStyle("red dim");
|
||||
AnsiConsole.Render(rule);
|
||||
```
|
||||
|
@ -51,10 +51,10 @@ For a list of borders, see the [Borders](xref:borders) appendix section.
|
||||
|
||||
```csharp
|
||||
// Sets the border
|
||||
table.SetBorder(Border.None);
|
||||
table.SetBorder(Border.Ascii);
|
||||
table.SetBorder(Border.Square);
|
||||
table.SetBorder(Border.Rounded);
|
||||
table.Border(TableBorder.None);
|
||||
table.Border(TableBorder.Ascii);
|
||||
table.Border(TableBorder.Square);
|
||||
table.Border(TableBorder.Rounded);
|
||||
```
|
||||
|
||||
## Expand / Collapse
|
||||
@ -79,7 +79,7 @@ table.HideHeaders();
|
||||
|
||||
```csharp
|
||||
// Sets the table width to 50 cells
|
||||
table.SetWidth(50);
|
||||
table.Width(50);
|
||||
```
|
||||
|
||||
# Column appearance
|
||||
@ -91,15 +91,17 @@ table.SetWidth(50);
|
||||
## Alignment
|
||||
|
||||
```csharp
|
||||
// Set the alignment explicitly
|
||||
column.SetAlignment(Justify.Right);
|
||||
column.Alignment(Justify.Right);
|
||||
column.LeftAligned();
|
||||
column.Centered();
|
||||
column.RightAligned();
|
||||
```
|
||||
|
||||
## Padding
|
||||
|
||||
```csharp
|
||||
// Set left and right padding
|
||||
column.SetPadding(left: 3, right: 5);
|
||||
column.Padding(left: 3, right: 5);
|
||||
|
||||
// Set padding individually.
|
||||
column.PadLeft(3);
|
||||
|
Loading…
x
Reference in New Issue
Block a user