views:

293

answers:

4

Hi,

I'm looking for some kind of text-parser for ASP.NET that can make HTML from some style of text that uses a special format. Like in Wiki's there is some special syntax for headings and such. I have tried to look on google, but I did not found anything for .NET.

Do someone know about a library for .NET that can parse the text to HTML wiki-style? I't don't have to be the same syntax as a Wiki? If no, how whould be the best way to design such a system your self?

Thanks in advance

+7  A: 

how about the Markdown that StackOverflow uses?

http://daringfireball.net/projects/markdown/

from their home page:

Thus, “Markdown” is two things: (1) a plain text formatting syntax; and (2) a software tool, written in Perl, that converts the plain text formatting to HTML.

Carlton Jenke
Thanks. Found that when i searched for a solution, but did not know there was a .NET Version of it. +1 :)
Jesper Blad Jensen aka. Deldy
+2  A: 

Markdown is great - very intuitive syntax, and you have WMD - this terrific editing tool that I'm typing into now.

Herb Caudill
+3  A: 

For the server side, you can use the Markdown.Net library from Milan Negovan : http://www.aspnetresources.com/blog/markdown_announced.aspx

Michel
+1  A: 

I would like to strongly recommend Textile over Markdown. Textile.NET should do what you want.

Why? I like Textile's syntax better, and I think it's easier for users to learn and use. There's no single large reason - just a lot of small things.

In Markdown you can do *italics* and **bold** easily, but the syntax seems arbitrary. Compare to the equivalent syntax in Textile for _italics_ and *bold*, which mirrors the conventional way to indicate those modifiers in plain text formats.

Or for another example, in Textile you make an ordered list by prefixing each item with an '#'. In Markdown, you prefix it with "n.", where n is any integer. Markdown is trying to imitate the syntax people use in flat text files when writing lists (which is nice), but it means that this Markdown code:

3.  Test1
2.  Test2
1.  Test3

Is rendered as this:

  1. Test1
  2. Test2
  3. Test3

Basically, Markdown asks you for a number, which it then ignores. That seems inelegant to me, although I couldn't explain why precisely.

Textile also does tables (and wish a nicely compact syntax). Markdown doesn't. There's a few other minor points, but I think that covers most of it. :)

Cody Hatch
it'd be more convincing with some actual *reasons* other than "I like it better". Just sayin'!
Jeff Atwood
Sadly, those really are the only reasons. I learned Textile faster than Markdown, and I think the syntax is prettier. *shrug*
Cody Hatch