MarkdownPlainTextRenderer Class

Renders a Markdown syntax tree as plain text, as MarkdownConverter.ToPlainText of Meziantou.Framework.Markdown 1.x does: the text of the HTML, without its tags and its HTML, and not escaped.

public static class MarkdownPlainTextRenderer

Example

var tree = MarkdownSyntaxTree.ParseText("# Title\n\nSome **bold** text and [a link](https://example.com).\n\n- First\n- Second");

Assert.Equal("Title\nSome bold text and a link.\nFirst\nSecond\n", MarkdownPlainTextRenderer.ToPlainText(tree));

Methods

NameDescription
ToPlainText(MarkdownSyntaxTree)Renders the document as plain text.
ToPlainText(MarkdownSyntaxTree, MarkdownHtmlRendererOptions?)Renders the document as plain text.

ToPlainText overloads

ToPlainText(MarkdownSyntaxTree)

MarkdownPlainTextRenderer.cs

Renders the document as plain text.

public static string ToPlainText(MarkdownSyntaxTree tree)
Parameters
tree MarkdownSyntaxTree
Returns

string

Exceptions
ArgumentNullException
tree is null.

ToPlainText(MarkdownSyntaxTree, MarkdownHtmlRendererOptions?)

MarkdownPlainTextRenderer.cs

Renders the document as plain text.

public static string ToPlainText(MarkdownSyntaxTree tree, MarkdownHtmlRendererOptions? options)
Parameters
tree MarkdownSyntaxTree
The document.
options MarkdownHtmlRendererOptions?
How to write the text, or null for MarkdownHtmlRendererOptions.Default: only the options that write text are used, such as the characters of SmartyPants, which are written decoded.
Returns

string

Exceptions
ArgumentNullException
tree is null.