Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 158 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

In How do you handle parameters & blocks when dynamically defining a method in Ruby? , code is being indented four spaces rather than the idiomatic two spaces, because the OP is using tabs.

If markdown treated tabs as being two spaces rather than four, then it would look idiomatic.

I assume this could be handled either based on markdown's automatic detection of programming lanuage, or the tags used.

If someone really likes four spaces per indentation level, then they can do so by manually using four spaces.

share|improve this question
Based on past experience, if you want a change made to the code formatter, you're probably going to be told to file a bug with Google Code Prettify instead of MSO, since that's the engine the team uses. – Pops Dec 14 '11 at 22:47
@PopularDemand: Detabbing is Markdown, though, not Prettify (actually, it's pretty much a Markdown preprocessing step). – balpha Dec 14 '11 at 23:47
Then I'm glad I left a "based on past experience" comment and not a real answer, @balpha. Thanks for the clarification. Is Prettify purely deciding which colors to assign to what text, then? – Pops Dec 15 '11 at 1:30
Yep; Prettify only ever sees the code after its has been converted from Markdown to HTML and added to the DOM as a <pre><code> block. All it then does is make it shine in pretty colors. @pop – balpha Dec 15 '11 at 8:13
  1. If there's one thing that you can call "majority agreement" in the whole tab-vs-spaces war, it's that one tab, when converted to spaces, equals four spaces. Second place being eight.
  2. I am not a Ruby programmer, but a quick web search suggests that by far not all people agree on the 2-spaces indentation.
  3. Would you also have to indent your code blocks by two tabs then for them to show up as code in Markdown?

But first and formost:

If they wanted to have "idiomatic" Ruby code, wouldn't they use two spaces instead of tabs?

share|improve this answer
More experienced users generally use two spaces, but newbies don't. – Andrew Grimm Dec 14 '11 at 23:57
@Andrew so you want to make it harder on newbies of every other language? – John Dec 15 '11 at 1:57
Ruby code which is tab-indented is not idomatic. There is no point in making it look idomatic, the whole point is to avoid tabs for exactly this reason. – meagar Dec 15 '11 at 6:09
@BobCratchit: I mentioned in the proposal that it'd only be for Ruby code, and discussed ways to have it only be done on Ruby code. – Andrew Grimm Dec 16 '11 at 1:36
@AndrewGrimm Ah sorry I missed that subtlety. – John Dec 16 '11 at 4:43

You must log in to answer this question.

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