Skip to content

Commit

Permalink
Make method reference to Markup.Escape more obvious
Browse files Browse the repository at this point in the history
best-practices refers and links to the `Markup.Escape` method but labeled it `EscapeMarkup`.

I got quite confused trying to find EscapeMarkup. Using the typical *class dot method* pattern seems preferable. It also matches what you write in code.
  • Loading branch information
Kissaki authored and patriksvensson committed Jun 23, 2024
1 parent ca441db commit b61fff0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/input/best-practices.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Spectre.Console will tell your terminal to use the color that is configured in t
If you are using an 8 or 24-bit color for the foreground text, it is recommended that you also set an appropriate
background color to match.

**Do** escape data when outputting any user input or any external data via Markup using the [`EscapeMarkup`](xref:M:Spectre.Console.Markup.Escape(System.String)) method on the data. Any user input containing `[` or `]` will likely cause a runtime error while rendering otherwise.
**Do** escape data when outputting any user input or any external data via Markup using the [`Markup.Escape`](xref:M:Spectre.Console.Markup.Escape(System.String)) method on the data. Any user input containing `[` or `]` will likely cause a runtime error while rendering otherwise.

**Consider** replacing `Markup` and `MarkupLine` with [`MarkupInterpolated`](xref:M:Spectre.Console.AnsiConsole.MarkupInterpolated(System.FormattableString)) and [`MarkupLineInterpolated`](xref:M:Spectre.Console.AnsiConsole.MarkupLineInterpolated(System.FormattableString)). Both these methods will automatically escape all data in the interpolated string holes. When working with widgets such as the Table and Tree, consider using [`Markup.FromInterpolated`](xref:M:Spectre.Console.Markup.FromInterpolated(System.FormattableString,Spectre.Console.Style)) to generate an `IRenderable` from an interpolated string.

Expand Down Expand Up @@ -119,4 +119,4 @@ For cmd.exe, the following steps are required to enable Unicode and Emoji suppor
5. Reboot.

You will also need to ensure that your Console application is configured to use a font that supports Unicode and Emoji,
such as Cascadia Code.
such as Cascadia Code.

0 comments on commit b61fff0

Please sign in to comment.