Question
Is there a Third Party library available for .NET projects that can convert a markdown document into html server-side? I.e. I've stored Markdown text in a database that needs to be converted to html when it is displayed.
I know about WMD, but it only converts client-side.
Solution
OTHER TIPS
Another implementation that seems to be gaining ground is MarkdownDeep
This is a full implementation for both C# and JavaScript. The MarkdownHelper on Nuget is using MarkdownDeep now instead of MarkdownSharp.
I've used both and MarkdownDeep seems to be more fully functional and having the JavaScript version is great for quick client side setups.
Check out Markdown Sharp. It's the open source library that resulted from the development of Stack Overflow and is much more robust/actively developed than markdown.net.
Markdown Sharp
Markdown Sharp isn't that bad code-wise either as John Leidegren noted, it's just not that easy to comment-out regular expressions or manage complex projects, w in in cleanest-OOP. It is definitely very fast and well-supported. I haven't found a Markup-parser based approach yet. Here is an example:
pattern = string.Format(@"
(?:
(?<=\n\n) # Starting after a blank line
| # or
\A\n? # the beginning of the doc
)
( # save in $1
[ ]{{0, {0}}}
<(hr) # start tag = $2
\b # word break
([^<>])*? #
/?> # the matching end tag
[ \t]*
(?=\n{{2,}}|\Z) # followed by a blank line or end of document
)", tabWidth - 1);
text = Regex.Replace(text, pattern, new MatchEvaluator(HtmlEvaluator), RegexOptions.IgnorePatternWhitespace);