views:

61

answers:

2

I've been finding that a lot of Github projects use Markdown. I originally thought this library was only needed on sites like StackOverflow that include the ability for users to add comments or posts that might include source code snippets. But some apps seem to use Markdown even when this is not the case.

Markdown is a lightweight markup language, originally created by John Gruber and Aaron Swartz to help maximum readability and "publishability" of both its input and output forms. The language takes many cues from existing conventions for marking up plain text in email. Markdown converts its marked-up text input to valid, well-formed XHTML and replaces left-pointing angle brackets ('<') and ampersands with their corresponding character entity references.

Currently I'm writing a web app that includes the ability for users to add comments. Is it possible that I should be using Markdown for this - even if the comments do not contain source code?

+1  A: 

If you want your users to be able to enter bold or italic text, or include links to other pages, then providing Markdown support is a good way to do that. Whether that's something you want to support is up to you, but it's useful, IMO.

Hank Gay
+1  A: 

Needing Markdown has nothing to do with being able to include source code. It's just a way to format text, in a simple format that is even readable when the formatter is not available. Historically, forum software used BB code for this, which is quite cumbersome for many users and does not offer the "readable" feature.

Anyway, the question you need to ask yourself, in this case, is: Do you want to enable your users to format the comments? If yes, you need some formatting library. Markdown may be a good idea then. It lines up with how people tend to markup in text-only environments anyway, like surrounding emphasized text with asterisks or underscores.

It's some sort of protection as well, since it replaces HTML markup with entities, basically preventing scripting attacks.

OregonGhost