Skip to content
Auto
Products

MarkdownRenderer

Namespace: TagBites.Text.Markdown
Assembly: TagBites.Text.Markdown.dll
Product: TagBites.Text.Markdown v. 2.2.0

The output an element writes itself into.

public abstract class MarkdownRenderer

Inheritance: object → MarkdownRenderer

Creates a renderer that writes with the given format, which the constructor makes read-only.

protected MarkdownRenderer(MarkdownFormat format)

Gets the format the document is written with.

public MarkdownFormat Format { get; }

MarkdownFormat

Gets the number of characters written so far.

public virtual int Length { get; }

int

Gets the text every new line starts with.

public string Prefix { get; }

string

Gets the level of the section being written, where zero means no section.

public int SectionLevel { get; }

int

Appends a single character, writing the prefix at the start of a line.

public void Append(char value)

Appends a single character, writing the prefix at the start of a line.

public void Append(string value)

Appends value``count times.

public void Append(char value, int count)

Appends the form of value that matches Format.

public void Append(MarkdownText value)

Ends the current line.

public void AppendLine()

Appends count spaces.

public void AppendSpaces(int count)

Sends everything the renderer still holds to its destination.

public virtual void Flush()

Runs after every line has been written.

protected virtual void OnLineWritten()

Removes the prefix added by the last PushPrefix(string).

public void PopPrefix()

Restores the level that was in place before the last PushSectionLevel(int).

public void PopSectionLevel()

Starts every following line with prefix on top of the current one.

public void PushPrefix(string prefix)

An empty line receives the prefix without its trailing spaces, so a quote keeps its marker.

Sets the level the sections written next are nested under.

public void PushSectionLevel(int level)

Drops everything past length.

protected virtual char TruncateCore(int length)

char

The character the output now ends with, or '\n' when nothing is left.

Writes to the destination, without touching the prefix.

protected virtual void Write(char value)

Writes to the destination, without touching the prefix.

protected virtual void Write(string value)