Gutenberg

Class ConsoleDocumentRenderer

An IDocumentRenderer<T> which writes formatted text to the Console.

Inheritance
  • object
  • ConsoleDocumentRenderer
Implements
Inherited Members
Declaration
public class ConsoleDocumentRenderer : IDocumentRenderer<ConsoleFormattingAnnotation>

Constructors

ConsoleDocumentRenderer()

An IDocumentRenderer<T> which writes formatted text to the Console.

Declaration
public ConsoleDocumentRenderer()

Methods

NewLine(CancellationToken)

Write a line break into the output stream.

Declaration
public ValueTask NewLine(CancellationToken cancellationToken = default)
Parameters
Type Name Description

CancellationToken

cancellationToken

A CancellationToken.

Returns
Type Description

ValueTask

A ValueTask which will complete when the line break has been written to the output stream.

PopAnnotation(CancellationToken)

Discard the value of a previous call to PushAnnotation(T, CancellationToken).

Declaration
public ValueTask PopAnnotation(CancellationToken cancellationToken = default)
Parameters
Type Name Description

CancellationToken

cancellationToken

A CancellationToken.

Returns
Type Description

ValueTask

A ValueTask which will complete when the value has been popped from the stack.

PushAnnotation(ConsoleFormattingAnnotation, CancellationToken)

Accept an annotation.

Declaration
public ValueTask PushAnnotation(ConsoleFormattingAnnotation value, CancellationToken cancellationToken = default)
Parameters
Type Name Description

ConsoleFormattingAnnotation

value

The annotation to push onto the stack.

CancellationToken

cancellationToken

A CancellationToken.

Returns
Type Description

ValueTask

A ValueTask which will complete when the value has been pushed onto the stack.

Text(ReadOnlyMemory<char>, CancellationToken)

Write some text into the output stream.

Declaration
public ValueTask Text(ReadOnlyMemory<char> memory, CancellationToken cancellationToken = default)
Parameters
Type Name Description

ReadOnlyMemory<char>

memory

The text to write to the output stream.

CancellationToken

cancellationToken

A CancellationToken.

Returns
Type Description

ValueTask

A ValueTask which will complete when the text has been written to the output stream.

WhiteSpace(int, CancellationToken)

Write the given amount of blank space into the output stream.

Declaration
public ValueTask WhiteSpace(int amount, CancellationToken cancellationToken = default)
Parameters
Type Name Description

int

amount

The amount of white space to write.

CancellationToken

cancellationToken

A CancellationToken.

Returns
Type Description

ValueTask

A ValueTask which will complete when the white space has been written to the output stream.

Implements

IDocumentRenderer<T>

Extension Methods

DocumentRendererExtensions.MapAnnotations<T, U>(IDocumentRenderer<U>, Func<T, U>)
DocumentRendererExtensions.MapAnnotations<T, U>(IDocumentRenderer<U>, Func<T, ValueTask<U>>)