Remove Render from docs in favor of Write (#613)

The `Render` method has been obsoleted.
This commit is contained in:
Patrik Svensson 2021-11-09 21:22:18 +01:00 committed by GitHub
parent e86f9d3c5a
commit 21ac952307
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 23 additions and 23 deletions

View File

@ -15,7 +15,7 @@ Console markup uses a syntax inspired by bbcode. If you write the style (see [St
in square brackets, e.g. `[bold red]`, that style will apply until it is closed with a `[/]`. in square brackets, e.g. `[bold red]`, that style will apply until it is closed with a `[/]`.
```csharp ```csharp
AnsiConsole.Render(new Markup("[bold yellow]Hello[/] [red]World![/]")); AnsiConsole.Write(new Markup("[bold yellow]Hello[/] [red]World![/]"));
``` ```
The `Markup` class implements `IRenderable` which means that you The `Markup` class implements `IRenderable` which means that you
@ -26,7 +26,7 @@ rendering of `IRenderable` also have overloads for rendering rich text.
var table = new Table(); var table = new Table();
table.AddColumn(new TableColumn(new Markup("[yellow]Foo[/]"))); table.AddColumn(new TableColumn(new Markup("[yellow]Foo[/]")));
table.AddColumn(new TableColumn("[blue]Bar[/]")); table.AddColumn(new TableColumn("[blue]Bar[/]"));
AnsiConsole.Render(table); AnsiConsole.Write(table);
``` ```
## Convenience methods ## Convenience methods

View File

@ -17,7 +17,7 @@ Use `BarChart` to render bar charts to the console.
### Basic usage ### Basic usage
```csharp ```csharp
AnsiConsole.Render(new BarChart() AnsiConsole.Write(new BarChart()
.Width(60) .Width(60)
.Label("[green bold underline]Number of fruits[/]") .Label("[green bold underline]Number of fruits[/]")
.CenterLabel() .CenterLabel()
@ -38,7 +38,7 @@ var items = new List<(string Label, double Value)>
}; };
// Render bar chart // Render bar chart
AnsiConsole.Render(new BarChart() AnsiConsole.Write(new BarChart()
.Width(60) .Width(60)
.Label("[green bold underline]Number of fruits[/]") .Label("[green bold underline]Number of fruits[/]")
.CenterLabel() .CenterLabel()
@ -72,7 +72,7 @@ var items = new List<Fruit>
}; };
// Render bar chart // Render bar chart
AnsiConsole.Render(new BarChart() AnsiConsole.Write(new BarChart()
.Width(60) .Width(60)
.Label("[green bold underline]Number of fruits[/]") .Label("[green bold underline]Number of fruits[/]")
.CenterLabel() .CenterLabel()

View File

@ -16,7 +16,7 @@ To render a calendar, create a `Calendar` instance with a target date.
```csharp ```csharp
var calendar = new Calendar(2020,10); var calendar = new Calendar(2020,10);
AnsiConsole.Render(calendar); AnsiConsole.Write(calendar);
``` ```
<?# AsciiCast cast="calendar" /?> <?# AsciiCast cast="calendar" /?>
@ -27,8 +27,8 @@ You can set the calendar's culture to show localized weekdays.
```csharp ```csharp
var calendar = new Calendar(2020,10); var calendar = new Calendar(2020,10);
calendar.Culture("ja-JP"); calendar.Culture("sv-SE");
AnsiConsole.Render(calendar); AnsiConsole.Write(calendar);
``` ```
<?# AsciiCast cast="calendar-culture" /?> <?# AsciiCast cast="calendar-culture" /?>
@ -40,7 +40,7 @@ You can hide the calendar header.
```csharp ```csharp
var calendar = new Calendar(2020,10); var calendar = new Calendar(2020,10);
calendar.HideHeader(); calendar.HideHeader();
AnsiConsole.Render(calendar); AnsiConsole.Write(calendar);
``` ```
You can set the header style of the calendar. You can set the header style of the calendar.
@ -48,7 +48,7 @@ You can set the header style of the calendar.
```csharp ```csharp
var calendar = new Calendar(2020, 10); var calendar = new Calendar(2020, 10);
calendar.HeaderStyle(Style.Parse("blue bold")); calendar.HeaderStyle(Style.Parse("blue bold"));
AnsiConsole.Render(calendar); AnsiConsole.Write(calendar);
``` ```
<?# AsciiCast cast="calendar-header" /?> <?# AsciiCast cast="calendar-header" /?>

View File

@ -26,7 +26,7 @@ var image = new CanvasImage("cake.png");
image.MaxWidth(16); image.MaxWidth(16);
// Render the image to the console // Render the image to the console
AnsiConsole.Render(image); AnsiConsole.Write(image);
``` ```
## Result ## Result
@ -50,7 +50,7 @@ image.BilinearResampler();
image.Mutate(ctx => ctx.Grayscale().Rotate(-45).EntropyCrop()); image.Mutate(ctx => ctx.Grayscale().Rotate(-45).EntropyCrop());
// Render the image to the console // Render the image to the console
AnsiConsole.Render(image); AnsiConsole.Write(image);
``` ```
## Result ## Result

View File

@ -28,7 +28,7 @@ for(var i = 0; i < canvas.Width; i++)
} }
// Render the canvas // Render the canvas
AnsiConsole.Render(canvas); AnsiConsole.Write(canvas);
``` ```
## Result ## Result

View File

@ -9,7 +9,7 @@ Spectre.Console can render [FIGlet](http://www.figlet.org/) text by using the `F
## Default font ## Default font
```csharp ```csharp
AnsiConsole.Render( AnsiConsole.Write(
new FigletText("Hello") new FigletText("Hello")
.LeftAligned() .LeftAligned()
.Color(Color.Red)); .Color(Color.Red));
@ -23,7 +23,7 @@ AnsiConsole.Render(
```csharp ```csharp
var font = FigletFont.Load("starwars.flf"); var font = FigletFont.Load("starwars.flf");
AnsiConsole.Render( AnsiConsole.Write(
new FigletText(font, "Hello") new FigletText(font, "Hello")
.LeftAligned() .LeftAligned()
.Color(Color.Red)); .Color(Color.Red));

View File

@ -18,7 +18,7 @@ To render a rule without a title:
```csharp ```csharp
var rule = new Rule(); var rule = new Rule();
AnsiConsole.Render(rule); AnsiConsole.Write(rule);
``` ```
## Title ## Title
@ -27,7 +27,7 @@ You can set the rule title markup text.
```csharp ```csharp
var rule = new Rule("[red]Hello[/]"); var rule = new Rule("[red]Hello[/]");
AnsiConsole.Render(rule); AnsiConsole.Write(rule);
``` ```
```text ```text
@ -41,7 +41,7 @@ You can set the rule's title alignment.
```csharp ```csharp
var rule = new Rule("[red]Hello[/]"); var rule = new Rule("[red]Hello[/]");
rule.Alignment = Justify.Left; rule.Alignment = Justify.Left;
AnsiConsole.Render(rule); AnsiConsole.Write(rule);
``` ```
```text ```text
@ -53,7 +53,7 @@ You can also specify it via an extension method:
```csharp ```csharp
var rule = new Rule("[red]Hello[/]"); var rule = new Rule("[red]Hello[/]");
rule.LeftAligned(); rule.LeftAligned();
AnsiConsole.Render(rule); AnsiConsole.Write(rule);
``` ```
```text ```text
@ -66,12 +66,12 @@ AnsiConsole.Render(rule);
```csharp ```csharp
var rule = new Rule("[red]Hello[/]"); var rule = new Rule("[red]Hello[/]");
rule.Style = Style.Parse("red dim"); rule.Style = Style.Parse("red dim");
AnsiConsole.Render(rule); AnsiConsole.Write(rule);
``` ```
You can also specify it via an extension method You can also specify it via an extension method
```csharp ```csharp
var rule = new Rule("[red]Hello[/]"); var rule = new Rule("[red]Hello[/]");
rule.RuleStyle("red dim"); rule.RuleStyle("red dim");
AnsiConsole.Render(rule); AnsiConsole.Write(rule);
``` ```

View File

@ -35,7 +35,7 @@ table.AddRow("Baz", "[green]Qux[/]");
table.AddRow(new Markup("[blue]Corgi[/]"), new Panel("Waldo")); table.AddRow(new Markup("[blue]Corgi[/]"), new Panel("Waldo"));
// Render the table to the console // Render the table to the console
AnsiConsole.Render(table); AnsiConsole.Write(table);
``` ```
This will render the following output: This will render the following output:

View File

@ -35,7 +35,7 @@ bar.AddNode(new Calendar(2020, 12)
.HideHeader()); .HideHeader());
// Render the tree // Render the tree
AnsiConsole.Render(root); AnsiConsole.Write(root);
``` ```
## Collapsing nodes ## Collapsing nodes