<p>[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.]</p>

<p>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.</p>

<p>A cursory search reveals <a href="http://aspnetresources.com/blog/markdown_announced.aspx" rel="noreferrer">a .NET Markdown to HTML converter</a>, and then we have <a href="http://www.codeproject.com/KB/edit/editor_in_windows_forms.aspx" rel="noreferrer">a Windows Forms-based text editor that outputs HTML</a>, 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.</p>

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

[{'answer_id': 31336, 'author': 'Jared Updike', 'author_id': 2543, 'author_profile': 'https://Stackoverflow.com/users/2543', 'pm_score': -1, 'selected': False, 'text': "<p>Can't you just use the same control I'm Stack Overflow uses (that we're all typing into)---WMD, and just store the Markdown in the VARCHAR. Then use the .NET Markdown to HTML converter, as you mentioned, to display the HTML as needed. Jeff talks about this in more detail in a StackOverflow podcast (don't know the episode number).</p>\n"}, {'answer_id': 31751, 'author': 'Brad Wilson', 'author_id': 1554, 'author_profile': 'https://Stackoverflow.com/users/1554', 'pm_score': 1, 'selected': False, 'text': '<p>@Soeren,</p>\n\n<p>You can most definitely embed IE with the Javascript Markdown editor inside a Windows Forms application.</p>\n'}, {'answer_id': 54961, 'author': 'Jared Updike', 'author_id': 2543, 'author_profile': 'https://Stackoverflow.com/users/2543', 'pm_score': 0, 'selected': False, 'text': '<blockquote>\n  <p>the RichTextBox control</p>\n</blockquote>\n\n<p>So you want to use Markdown but you want the user not to know it? This might not be an achievable goal. I think the point of Markdown is that it is geared toward writers that are willing to learn a little bit of fairly natural syntax and edit everything in plain text (like Wikipedia? are there pure WYSIWYG editors for that? probably... and probably some other Wikipedia editor person has to come and clean up the resulting markup and formatting...). If you want it to be transparent to the user (like MS Word) Markdown may not be what you want or give you the advantages it advertises in that situation.</p>\n\n<blockquote>\n  <p>The input happens in Windows Forms</p>\n</blockquote>\n\n<p>Oops! Now I understand better your question. I guess it depends on how your Windows Forms app looks whether the embedded IE control sticks out like a sore thumb. If you try it you might find that you can get it to work.[1]</p>\n\n<p>In your position, I would try something like this [2]:</p>\n\n<ul>\n<li><a href="http://wmd-editor.com/examples/splitscreen" rel="nofollow noreferrer">http://wmd-editor.com/examples/splitscreen</a></li>\n</ul>\n\n<p>If you don\'t think that sort of arrangement will go over well with your users, (especially all the editing in the text-only window) then once again I don\'t think Markdown is the answer for your specific application. If you think your users are keen on the idea of editing pure text, then I bet we can find a solution. Please clarify?</p>\n\n<p>Jared.</p>\n\n<p>[1] I had success dropping an IE HTML control into a project strictly to display some generated results as a PDF (using an IE Reader plugin like Adobe Reader or Foxit). The user has no idea that that part of the GUI is an IE control, it just shows the PDF, allows printing and saving, etc.</p>\n\n<p>[2] ...but remove the borders and make the two split controls touch all four edges of the embedded IE control, or get very close... keep it light grey or white, for example, and eliminate any borders of the IE control so it blends into the surrounding controls. Maybe put this on its own tab page and I challenge a non-technical user to tell/care if it\'s an HTML control or native.</p>\n\n<p>I could totally be wrong about all this (one would have to see this in action to determine if it would work) but it might be easier than writing your own interactive Markdown editor...</p>\n\n<p>...actually to implement your own C# Markdown editor, you could just put a text edit box next to an embedded IE control and run the current Markdown through the .NET Markdown->HTML converter on a separate thread, and replace the HTML in the IE control (assuming the Markdown->HTML converter is very liberal and robust against throwing ANY exceptions).</p>\n'}, {'answer_id': 684045, 'author': 'devios1', 'author_id': 238948, 'author_profile': 'https://Stackoverflow.com/users/238948', 'pm_score': -1, 'selected': False, 'text': '<p>"WYSIWYG Markdown" is really an oxymoron since the whole point of Markdown is to allow you to write markup syntax naturally and intuitively which is then post-processed into html, <em>unless</em> you mean actually taking for example **text** and rendering it as <strong>**text*</strong>* for example. That would actually be kind of cool, but it would get very difficult for things like numbered and bulleted lists, since you would have to do all the positioning, yet keep everything based on actual textual characters (e.g. \'*\' instead of the bullet symbol) and support proper textual input positioning, backspace, etc.</p>\n\n<ul>\n<li>For example,</li>\n<li>in this bullet list,</li>\n<li>the bullets would actually have to be asterisks,</li>\n<li>and the spacing would not really be there.</li>\n</ul>\n\n<p>That would certainly be worth paying attention to, if someone did tackle it.</p>\n'}, {'answer_id': 58964550, 'author': 'KyleMit', 'author_id': 1366033, 'author_profile': 'https://Stackoverflow.com/users/1366033', 'pm_score': 4, 'selected': False, 'text': '<p>I think the best approach for this is to combine </p>\n\n<ol>\n<li><a href="https://stackoverflow.com/q/460483/1366033">Converting Markdown to HTML</a> &amp;</li>\n<li><a href="https://stackoverflow.com/a/12724381/1366033">Displaying HTML in WinForms</a></li>\n</ol>\n\n<p>The most up to date Markdown Library seems to be <a href="https://github.com/lunet-io/markdig" rel="noreferrer"><strong>markdig</strong></a> which you can install <a href="https://www.nuget.org/packages/Markdig/" rel="noreferrer">via nuget</a></p>\n\n<p><a href="https://i.stack.imgur.com/Gl8UV.png" rel="noreferrer"><img src="https://i.stack.imgur.com/Gl8UV.png" alt="Nuget &gt; Markdig"></a></p>\n\n<p>A simple implementation might be to:</p>\n\n<ol>\n<li>Add a <code>SplitContainer</code> to a <code>Form</code> control, set <code>Dock = Fill</code></li>\n<li>Add a <code>TextBox</code>, set <code>Dock = Fill</code> and set to <code>Multiline = True</code></li>\n<li>Add a <code>WebBrowser</code>, set <code>Dock = Fill</code></li>\n</ol>\n\n<p>Then handle the <code>TextChanged</code> event, parse the text into html and set to <code>DocumentText</code> like this:</p>\n\n<pre class="lang-cs prettyprint-override"><code>private void textBox1_TextChanged(object sender, EventArgs e)\n{\n    var md = textBox1.Text;\n    var html = Markdig.Markdown.ToHtml(md);\n    webBrowser1.DocumentText = html;\n}\n</code></pre>\n\n<p>Here\'s a recorded demo:</p>\n\n<p><a href="https://i.stack.imgur.com/XcOsX.gif" rel="noreferrer"><img src="https://i.stack.imgur.com/XcOsX.gif" alt="Demo screen share"></a></p>\n'}]
['https://Stackoverflow.com/questions/30928', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1600/']