API Reference
ConsoleExporter
Exports a widget, a rendered frame or a live-session snapshot to self-contained HTML (inline CSS, selectable text, a light and a dark rendering that follow prefers-color-scheme), SVG (crisp shapes for box, block and braille characters, selectable text, no external assets) or plain text. Cell geometry is kept exactly: every glyph sits on the grid, colours and styles are kept, and OSC 8 links become links (web and mail links only).
Inheritance
- Object
- ConsoleExporter
Methods
public static String Export(IWidget widget, ExportFormat format, ExportOptions? options = null) #StringExports a widget in a format.
Parameters
- widget ConsoleMonster.Layout.IWidget
- The widget.
- format ConsoleMonster.Export.ExportFormat
- Html, Svg or Text.
- options ConsoleMonster.Export.ExportOptions? = null
- The options.
Returns
The exported document.
public static String Export(CellBuffer frame, ExportFormat format, ExportOptions? options = null) #StringExports a frame in a format.
Parameters
- frame ConsoleMonster.Canvas.CellBuffer
- The frame.
- format ConsoleMonster.Export.ExportFormat
- Html, Svg or Text.
- options ConsoleMonster.Export.ExportOptions? = null
- The options.
Returns
The exported document.
public static ExportFormat FormatFor(String path) #ExportFormatThe format a file extension implies.
Parameters
- path System.String
- The path.
Returns
Html for .html/.htm, Svg for .svg, Asciicast for .cast, Text otherwise.
public static CellBuffer Render(IWidget widget, ExportOptions options, ITheme theme) #CellBufferRenders a widget the way an export does (fixed size, the export's glyph tier and colour depth).
Parameters
- widget ConsoleMonster.Layout.IWidget
- The widget.
- options ConsoleMonster.Export.ExportOptions
- The options.
- theme ConsoleMonster.Styling.ITheme
- The theme.
Returns
The frame.
public static Void Save(IWidget widget, String path, ExportFormat? format = null, ExportOptions? options = null) #VoidWrites an export to a file as UTF-8 without a byte order mark.
Parameters
- widget ConsoleMonster.Layout.IWidget
- The widget.
- path System.String
- The file.
- format ConsoleMonster.Export.ExportFormat? = null
- The format; null picks it from the extension (.html/.htm, .svg, anything else text).
- options ConsoleMonster.Export.ExportOptions? = null
- The options.
public static String ToHtml(IWidget widget, ExportOptions? options = null) #StringExports a widget as an HTML page.
Parameters
- widget ConsoleMonster.Layout.IWidget
- The widget.
- options ConsoleMonster.Export.ExportOptions? = null
- Size, theme, font and window frame.
Returns
The HTML.
public static String ToHtml(CellBuffer frame, ExportOptions? options = null) #StringExports a rendered frame as an HTML page. Theme Auto keeps the frame's colours and lets default text follow the viewer.
Parameters
- frame ConsoleMonster.Canvas.CellBuffer
- The frame.
- options ConsoleMonster.Export.ExportOptions? = null
- Theme, font and window frame (the size is the frame's).
Returns
The HTML.
public static String ToHtml(LiveSession session, ExportOptions? options = null) #StringExports what a live session shows now as an HTML page.
Parameters
- session ConsoleMonster.Live.LiveSession
- The session.
- options ConsoleMonster.Export.ExportOptions? = null
- Theme, font and window frame.
Returns
The HTML.
public static String ToSvg(IWidget widget, ExportOptions? options = null) #StringExports a widget as an SVG image.
Parameters
- widget ConsoleMonster.Layout.IWidget
- The widget.
- options ConsoleMonster.Export.ExportOptions? = null
- Size, theme, font and window frame.
Returns
The SVG.
public static String ToSvg(CellBuffer frame, ExportOptions? options = null) #StringExports a rendered frame as an SVG image.
Parameters
- frame ConsoleMonster.Canvas.CellBuffer
- The frame.
- options ConsoleMonster.Export.ExportOptions? = null
- Theme, font and window frame.
Returns
The SVG.
public static String ToSvg(LiveSession session, ExportOptions? options = null) #StringExports what a live session shows now as an SVG image.
Parameters
- session ConsoleMonster.Live.LiveSession
- The session.
- options ConsoleMonster.Export.ExportOptions? = null
- Theme, font and window frame.
Returns
The SVG.
public static String ToText(IWidget widget, ExportOptions? options = null) #StringExports a widget as plain text (trailing spaces and empty last lines trimmed).
Parameters
- widget ConsoleMonster.Layout.IWidget
- The widget.
- options ConsoleMonster.Export.ExportOptions? = null
- Size and glyph tier.
Returns
The text.
public static String ToText(CellBuffer frame, ExportOptions? options = null) #StringExports a rendered frame as plain text.
Parameters
- frame ConsoleMonster.Canvas.CellBuffer
- The frame.
- options ConsoleMonster.Export.ExportOptions? = null
- Unused; for symmetry with the other formats.
Returns
The text.
public static String ToText(LiveSession session, ExportOptions? options = null) #StringExports what a live session shows now as plain text.
Parameters
- session ConsoleMonster.Live.LiveSession
- The session.
- options ConsoleMonster.Export.ExportOptions? = null
- Unused; for symmetry with the other formats.
Returns
The text.
Inherited Methods
public virtual Boolean Equals(Object? obj) #BooleanParameters
- obj Object?
Properties
public static String PlayerScript { get; } #The recording player script (a native asset, player.js): include it once on a page with ConsoleExporter.PlayerStyles, then mark each player with data-cm-recording pointing at data from Recording.ExportPlayerData (a URL, or #id of an inline application/json script element); data-cm-autoplay asks to autoplay. The HTML recording export embeds it.
public static String PlayerStyles { get; } #The recording player styles (a native asset, player.css); see ConsoleExporter.PlayerScript.