[We have a Windows Forms database front-end application that, among other things, can be used as a CMS; clients create the structure, fill it, and then use a ASP.NET WebForms-based site to present the results to publicly on the Web. For added flexibility, they are sometimes forced to input actual HTML markup right into a text field, which then ends up as a varchar in the database. This works, but it's far from user-friendly.]

As such… some clients want a WYSIWYG editor for HTML. I'd like to convince them that they'd benefit from using simpler language (namely, Markdown). Ideally, what I'd like to have is a WYSIWYG editor for that. They don't need tables, or anything sophisticated like that.

A cursory search reveals a .NET Markdown to HTML converter, and then we have a Windows Forms-based text editor that outputs HTML, but apparently nothing that brings the two together. As a result, we'd still have our varchars with markup in there, but at least it would be both quite human-readable and still easily parseable.

Would this — a WYSIWYG editor that outputs Markdown, which is then later on parsed into HTML in ASP.NET — be feasible? Any alternative suggestions?

I think the best approach for this is to combine

  1. Converting Markdown to HTML &
  2. Displaying HTML in WinForms

The most up to date Markdown Library seems to be markdig which you can install via nuget

Nuget > Markdig

A simple implementation might be to:

  1. Add a SplitContainer to a Form control, set Dock = Fill
  2. Add a TextBox, set Dock = Fill and set to Multiline = True
  3. Add a WebBrowser, set Dock = Fill

Then handle the TextChanged event, parse the text into html and set to DocumentText like this:

private void textBox1_TextChanged(object sender, EventArgs e)
{
    var md = textBox1.Text;
    var html = Markdig.Markdown.ToHtml(md);
    webBrowser1.DocumentText = html;
}

Here's a recorded demo:

Demo screen share