You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In my app, I am adding an option to update an HTML page.
I have figured out how to use the Recorder to capture the output my program emits and produce HTML output.
However, I would like to not display to the screen when I want to produce HTML. I have figured out how to make a fake IAnsiConsole and can see the ANSI output appear in the StringWriter of my fake console, but whenever I try to get the recorder to emit the HTML, it just produces a blank "pre" HTML element.
void GenHtml() {
var fakeConsoleOutput = new FakeConsoleOutput();
var fakeConsole = AnsiConsole.Create(new AnsiConsoleSettings
{
Ansi = AnsiSupport.Yes,
Out = fakeConsoleOutput,
Interactive = InteractionSupport.No,
ColorSystem = ColorSystemSupport.TrueColor,
});
using var fakeRecorder = new Recorder(fakeConsole);
discover.PrintDiscoveryTable(fakeConsole, devices, jsonStdErr);
string fakeHtml = fakeRecorder.ExportHtml();;
AnsiConsole.Record();
discover.PrintDiscoveryTable(AnsiConsole.Console, devices, jsonStdErr);
string realHtml = AnsiConsole.ExportHtml();;
}
class FakeConsoleOutput : IAnsiConsoleOutput
{
public TextWriter Writer { get; } = new StringWriter();
public bool IsTerminal => false;
public int Width => 220;
public int Height => 100;
public void SetEncoding(Encoding encoding) {}
}
Any thoughts how I can get HTML from my fake console
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
In my app, I am adding an option to update an HTML page.
I have figured out how to use the Recorder to capture the output my program emits and produce HTML output.
However, I would like to not display to the screen when I want to produce HTML. I have figured out how to make a fake IAnsiConsole and can see the ANSI output appear in the StringWriter of my fake console, but whenever I try to get the recorder to emit the HTML, it just produces a blank "pre" HTML element.
Any thoughts how I can get HTML from my fake console
Beta Was this translation helpful? Give feedback.
All reactions