Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Created June 26, 2020 09:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjoerntx/01730a6c67196cd675b1b20057da5c1f to your computer and use it in GitHub Desktop.
Save bjoerntx/01730a6c67196cd675b1b20057da5c1f to your computer and use it in GitHub Desktop.
public static class TextControlExtensions
{
public static void LoadMarkdown(this TXTextControl.TextControl textControl,
string markdown)
{
textControl.Load(ParseMarkdown(markdown), TXTextControl.StringStreamType.HTMLFormat);
}
private static string ParseMarkdown(string markdownInput)
{
var pipeline = new MarkdownPipelineBuilder().UseAdvancedExtensions().Build();
return Markdown.ToHtml(markdownInput, pipeline);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment