6

How are the comment fields on Stack Exchange sites converted from text to HTML?

I'm looking into doing something similar (not for comments, but for writing small lists with bold and italic text). Is the text here parsed? Is there some regex that looks for text like "**bold**" and converts the double stars to open/close <strong> tags?

I'm also looking at parsing (Textile in particular). Just wondering what the some of the options are.

1 Answer 1

7

It's called Markdown. If you download the WMD editor (either the main version or SO's fork), you'll find a file showdown.js that does the Markdown-to-HTML conversion. (There are server-side libraries for it too, of course.)

WMD is mainly the editor for questions and answers, not comments, but SO is using a subset of the Markdown syntax available in questions and answers for comments now too.

2
  • typo, I was actually looking for the editor conversion. (:
    – peirix
    Jul 8, 2009 at 8:31
  • is there an api for this that I can use to write my own word processor, in say... java?
    – Ephraim
    Apr 20, 2012 at 18:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .