ITextEncoder Interface

Namespace
Kampute.DocToolkit.Formatters
Assembly
  • Kampute.DocToolkit.dll

Definition

Defines a contract for text encoders of specific formats.
public interface ITextEncoder
Implemented by

Remarks

The ITextEncoder interface defines a standard method for encoding text content to ensure it's properly formatted for a specific output format (such as HTML or Markdown).

Implementations handle format-specific encoding concerns, like escaping special characters that have syntactic meaning in the target format. For example, HTML encoders escape characters like '<' and '>', while Markdown encoders escape characters like '*' and '#'.

This interface is typically used in conjunction with documentation formatters to ensure that text content is safely embedded in generated documentation without breaking the format's syntax.

Methods

Encode(ReadOnlySpan<char>, TextWriter)Encodes the specified text for the target format and writes it to the specified writer.