Why does Stack Exchange use Markdown? I think HTML could be fine as well. Does Markdown have more advantages over HTML?

  • 1
    SE does allow a small set of HTML, see meta.stackexchange.com/q/1777/213671 – gunr2171 Feb 26 '14 at 14:38
  • 2
    There are other better reasons, but it's partly because Jeff likes Markdown – Jonathan Garber Feb 26 '14 at 14:39
  • 7
    Do you expect all the pets.se, cooking.se and similar non-technical site users to be fluent in HTML? Markdown is a much simpler notation that is much easier to grasp and use. – Oded Feb 26 '14 at 14:40
  • It's standard, that's why. Like OpenID and other standards they follow too. – Shadow Wizard Feb 26 '14 at 14:41
  • 2
    It's a half way house between bland text and full HTML. You don't need so much knowledge to use it. Even for programming sites it still makes sense. I must admit, despite being a programmer I have never learned HTML because I find it insanely boring – Richard Tingle Feb 26 '14 at 14:43
  • @RichardTingle I would've avoided it if at all possible. However, apparently (without my knowledge) as some point in the past few years I became a de-facto web developer. Oh well. Them's the breaks. – MikeTheLiar Feb 26 '14 at 14:46
  • 6
    Ehm people, am I missing something? This seems like a fair enough question to me. Why the flood of downvotes? – Bart Feb 26 '14 at 14:55
  • @Bart I think people are interpreting this as a feature request, which is frankly unfair and I agree with you – Richard Tingle Feb 26 '14 at 15:02
  • 6
    @Bart Sir, I am a big boy now, I can handle that pressure.(sobbing in the dark corner alone) – Ave Maleficum Feb 26 '14 at 15:04
  • I'm sure you can @AveMaleficum. I'm just baffled, that's all. – Bart Feb 26 '14 at 15:04
  • @AveMaleficum I'd give you a +1 just for that comment, sadly you already have it – Richard Tingle Feb 26 '14 at 15:05
  • @Bart because of this: "I think HTML could be fine as well" - people simply disagree with this statement. – Shadow Wizard Feb 26 '14 at 15:19
  • Pff, if that's all it takes @ShadowWizard ... – Bart Feb 26 '14 at 15:20
up vote 16 down vote accepted

These are the reasons I can think of:

  • It's easy: Using markdown doesn't require any technical knowledge whatsoever. The syntax is so simple and it's very easy for people with any level of technical skill.

  • It's fast: It speeds up the workflow significantly. You don't have to bother about getting the HTML markup right. Markdown does it for you.

  • It's clean: Markdown creates perfectly formed HTML for you. You don't have to worry about improperly nested tags, unclosed tags or anything. Markdown takes care of it.

  • It's suitable for all workflows: Stack Overflow is not the only site that uses Markdown. AFAIK, all the Stack Exchange sites use Markdown for formatting. As Oded said in the comments below the question, you can't expect the users of pets.se or gaming.se to know HTML. Markdown is not as hard to learn. If you can write a simple smiley, you can use Markdown. It's that simple!

  • 1
    Indeed. Instead you have to worry about unclosed markdown segments and incompatibilities between segments (e.g. code blocks and lists). </devils-advocate-mode> – Frédéric Hamidi Feb 26 '14 at 14:47
  • 1
    And probably because Jeff loves it. – Amal Murali Feb 26 '14 at 14:50
  • 1
    @minitech: I realized that mistake only after the 5 minutes grace period, and then thought "Oh, minitech would edit this anyway, so why should I!". Thanks, btw :) – Amal Murali Feb 26 '14 at 16:02

The first and foremost reason to use markdown instead of plain HTML may very well be security.

Just think what code-injection nightmare embedded <script \> tags could be.

It's probably easier to build a simple markdown language than to sanitize whatever HTML code users will throw at you.

  • 3
    No, it’s not. Sanitizing HTML is pretty easy, and you have to do it anyways to support Markdown (which supports all HTML – well, probably not <plaintext> and <xmp>). – Ry- Feb 26 '14 at 15:10
  • My guess is that if you are handling markdown, then you can treat a subset of HTML just as the other markdown, and escape all the rest. I haven't checked, but there may be quite a difference between the HTML the user writes on an answer and the HTML that is displayed. – Agostino Feb 26 '14 at 15:18
  • 1
    There is a big difference – because it’s sanitized. At least, I hope it’s sanitized. Having each HTML element supported treated as part of the Markdown syntax sounds error-prone. – Ry- Feb 26 '14 at 15:21

You must log in to answer this question.

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