XenoAtom.Ansi is the low-level ANSI/VT library that powers markup and styling in XenoAtom.Terminal and XenoAtom.Terminal.UI.
It provides:
Terminal.UI uses XenoAtom.Ansi markup syntax in multiple places:
Markup controlHelpMarkup(...))MarkupTextParser)Example:
new Markup("[bold yellow]Warning:[/] disk is almost full");
Markup is designed to be safe with interpolated values: user input is escaped so it cannot inject tags when you use the interpolated handler APIs. When you build markup manually, you can escape with:
using XenoAtom.Ansi;
var safe = AnsiMarkup.Escape(userInput);
See:
Terminal.UI does not render "raw ANSI". It parses markup into:
StyledRun[]) that reference Terminal.UI.StyleThese runs are then rendered into a CellBuffer.
If you are using XenoAtom.Terminal directly (without Terminal.UI), XenoAtom.Ansi provides AnsiWriter for producing escape sequences efficiently:
using XenoAtom.Ansi;
using var b = new AnsiBuilder();
var w = new AnsiWriter(b);
w.Foreground(AnsiColors.BrightYellow).Decorate(AnsiDecorations.Bold).Write("Warning").ResetStyle();
Terminal.UI renders a CellBuffer and then writes ANSI via the host. AnsiWriter is most useful when you are building a CLI/TUI directly on XenoAtom.Terminal.
CellBuffer.See: