What is Markdown?
Markdown is a popular way to create content on the web. It is a very simple set of formatting rules to format words as bold or italic, adding images and to create lists. Many developers use Markdown for documentation files for repositories like in GitHub, Gists and readme files.
The popular NuGet package Markdig is able to parse Markdown content in order to create clean HTML. The project is also hosted on GitHub:
In this sample, we utilize this package to convert the plain text Markdown content of a TextControl ╰ TX Text Control .NET for Windows Forms
╰ TXTextControl Namespace
╰ TextControl Class
The TextControl class implements a Windows Forms control with high-level text editing features. to convert it to HTML that is loaded into a second TextControl.
Thanks to the clean output of the Markdown parser, it is very easy to style the various stylesheet elements within TX Text Control. This way, you can create pixel-perfect documents such as Adobe PDF from your Markdown content.
LoadMarkdown Extension Method
The sample implements the extension method LoadMarkdown for TX Text Control to load Markdown directly:
The implementation of this method is shown below:
You can download the Windows Forms sample from our GitHub repository below. This concept is not limited to Windows Forms, but can be used with all TX Text Control versions.