What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 131 Stack Exchange communities.

Pretty much as the title says. Is there a reason I should favor Markdown over HTML in posts to Stack Exchange sites?

EDIT: The only advantage of Markdown in comments is that less characters are used. In fact, for sites like this I don't see any point in using Markdown; what would be much more useful is a WYSIWYG editor, because the posts are never viewed in raw text format, except in editing but a WYSIWYG would solve that. and I'm guessing that once you've posted the Markdown is converted into HTML and the exact markdown you used is lost?

While Markdown can make sense for programmer sites, sites like Cooking are less likely to know it and more likely to know BBCode or something that most forums use at least.

share|improve this question
3  
The exact markdown isn't lost. If you click "edit" to edit your post again, you get the markdown source to edit. –  sth Feb 20 '11 at 16:30
3  
Changed my upvote into a downvote: please no WYSIWYG editor, if only for screen readers, the API and datadumps. Type what you mean, not how you want it to look. –  Arjan Feb 20 '11 at 16:42
    
I don't see how the API (returns post content in HTML) would be affected by a WYSIWYG, for screen readers you could auto-disable the W->G editor and have the existing one, in the same way the editor now is disabled for iPhone/iOS. By W->G editor I mean instead of having a text and a preview, hide the textbox (so the post produced is still exactly the same) and edit directly on the preview. So the only thing that is changed is the way a typical user enters a question/answer, not any of the backend stuff. –  Jonathan. Feb 20 '11 at 17:11
    
I'm referring to the output, Jonathan, not the input. The formatting as supported by Markdown should be enough for most Q&A sites. That said, you indeed did not claim you wanted more formatting options, so sorry for my knee-jerk reaction, being afraid of opening the Microsoft Word class="MsoNormal" hell. –  Arjan Feb 20 '11 at 17:56
    
@Arjan: I completely understand the Word hell. I'm just saying a WYSIWYG editor, could be useful. Like wordpress which has the option to site between raw and WYSIWYG editors. –  Jonathan. Feb 20 '11 at 17:58

3 Answers 3

up vote 2 down vote accepted

If it works, it probably means Jeff doesn't mind.

Is there a reason I should markdown over HTML in posts to stackexchange sites?
Only if you value your time :) Seriously, it's so much easier to create a link with ctrl-L instead of typing <a href="">...</a>.

share|improve this answer
    
Ok well on a computer it's easier but on an iPhone where you have to remember the markdown for links and images it's not so easy. –  Jonathan. Feb 20 '11 at 14:28
    
@Jonathan Didn't think of that. But we don't have shortcuts for comments either and so I've got used to [surprise](http://google.com) (and it still seems much shorter than <a...). –  Nikita Rybak Feb 20 '11 at 14:33
3  
@Jonathan - I regularly post from iPod - and it is much easier to enter markdown than html... –  Marc Gravell Feb 21 '11 at 6:38
    
@Marc I guess its preference but for me I find it easier to do links and Images in HTML. –  Jonathan. Feb 21 '11 at 10:03

Markdown produces correctly formated, highlighted and escaped code blocks, Html formatting usually doesn't. So at least for code blocks markdown is preferable.

Indented four spaces:

std::vector<int> x;
std::string str = "<b>text</b><br/>";

Wrapped in <pre><code>:

std::vector x;
std::string str = "text
";

Markdown is also usually much more concise, making it more comfortable to type.

share|improve this answer
    
but the markdown gets converted into HTML in the end?? Whats the difference between using ` or <pre><code> as the ` will get submitted with <pre><code>. And the highlighting is down with Prettify on the local computer? –  Jonathan. Feb 20 '11 at 16:18
3  
@Jonathan: If your code contains < or > or & the markdown will automatically escape it, so that it is displayed correctly. If you use <pre><code> you have to do that manually. (For example try writing about some code that contains html tags) –  sth Feb 20 '11 at 16:23
    
@sth It works at least in preview and at least for some tags. Try <b>bold text</b> or <br/>. –  Nikita Rybak Feb 20 '11 at 16:29
    
@Nikita: See my edited post. –  sth Feb 20 '11 at 16:33
    
@sth: Oh never noticed that, surely that's more to do with the SO site than HTML vs Markdown? –  Jonathan. Feb 20 '11 at 16:34
    
@sth I see your point. You probably wanted to say "markdown will automatically escape it inside code blocks". –  Nikita Rybak Feb 20 '11 at 16:40
2  
@Jonathan: A HTML tag is a HTML tag, it doesn't know by itself if you intended it to be displayed literally or to be used as formatting. You need to somehow mark what should be displayed literally. Here this is usually done with backticks or four-space indentation. If you write "My <br> tags aren't displayed correctly", how should SO know if you intended that to be a line break or a literal <br>? –  sth Feb 20 '11 at 16:45
    
@sth, I know it can't read my mind, but the software the SO runs knows to escape anything in between 2 ` (or after 4 spaces) so why can't it be edited to know to escape anything in between <pre><code> and </code></pre> –  Jonathan. Feb 20 '11 at 17:05
    
@Jonathan Markdown is escaping those, not SO. –  nyuszika7h Feb 20 '11 at 17:12
    
@Nyuszika7H: Isn't markdown a syntax? Or have I got this completely wrong. –  Jonathan. Feb 20 '11 at 17:16
    
@Jonathan Sorry, I meant the Markdown parser. –  nyuszika7h Feb 20 '11 at 17:29
    
@Jonathan: Currently HTML tags are simply interpreted as HTML, they mean exactly what those HTML tags usually mean, not more and not less. That's a rather simple principle. If <pre><code> now suddenly escapes its contents this would be unexpected to people who expect it to work like usual HTML. It's useful to have some special syntax that escapes its contents, so why can't this be ` or indentation? Changing the usually meaning of the <pre><code> HTML tags doesn't seem to have advantages, it only seems to be surprising and confusing. –  sth Feb 21 '11 at 23:07

It is OK, but Markdown is generally saner to edit -- as it mimics common ASCII formatting conventions that have been used in plain text email since the 1980s.

share|improve this answer
    
have you ever considered a WYSIWYG editor? Thats optional (similar to wordpress) –  Jonathan. Feb 21 '11 at 10:05
1  
@jonathan nope, we will never do that. We're part wiki. If you can get Wikipedia to adopt WYSIWYG I will consider it. –  Jeff Atwood Feb 21 '11 at 20:37
    
surely having the option can't hurt, and isn't the asking a question more like the forum part of SO, than the wiki. I always thought the wiki part was more where you access older questions from search engines? –  Jonathan. Feb 21 '11 at 20:49
    
@Jonathan: There is a WYSIWYG realtime preview, isn't that nearly as good? –  sth Feb 21 '11 at 22:50
    
@sth: Im just saying it would be better to have the option of an editor. –  Jonathan. Feb 21 '11 at 22:52

You must log in to answer this question.

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