Constructor AnsiConsoleMarkupOutput
- Namespace
- Ploch.CommandLine.Spectre.Output
- Assembly
- Ploch.CommandLine.Spectre.dll
AnsiConsoleMarkupOutput(IAnsiConsole, IMessageFormatterProcessor)
Provides an implementation of IOutput that uses Spectre.Console's ANSI console for markup-enabled output.
public AnsiConsoleMarkupOutput(IAnsiConsole console, IMessageFormatterProcessor formatterProcessor)
Parameters
consoleIAnsiConsoleThe ANSI console instance used for rendering output.
formatterProcessorIMessageFormatterProcessorThe processor used for formatting messages.
Remarks
Markup is parsed only where the caller asks for it: Markup(string), MarkupLine(string),
MarkupInterpolated(FormattableString), MarkupLineInterpolated(FormattableString) and, by default through
FormattableStringMessageWriter, a FormattableString passed to
Write<TMessage>(TMessage, IFormatProvider?) or WriteLine<TMessage>(TMessage). A plain string is written
verbatim, which mirrors the split Spectre.Console itself makes between IAnsiConsole.Write(string) and
IAnsiConsole.Markup(string).
Write<TMessage>(TMessage, IFormatProvider?) and WriteLine<TMessage>(TMessage) render an Spectre.Console.Rendering.IRenderable through the console and hand every other message to the registered IMessageWriter instances, including a string and a FormattableString: the built-in StringMessageWriter and FormattableStringMessageWriter are what write them, so a consumer that registers a writer for either type changes how that type renders. Only a message no writer accepts falls back to this class's own text rendering.