4

It would be great if Stack Overflow, and other code-centric Stack Exchange sites, used Behave.js for the main question/answer textareas.

It offers lots of nice little features for entering code, such as great indentation support (saving lots of spacebar presses), without going overkill like many other IDE-style javascript plugins.

Update

Let me address a couple concerns:

it's not clear that the code fencing support could be made to be consistent with markdown

The fence option is disabled by default, which means that the IDE behaviors get applied to all the text in the textarea, not just the text within a “fence” (e.g. ```). We’ve been using Behave.js on all of the documentation on http://buildwithcraft.com/docs, most of which isn’t code, and we’ve left the fence option set to false. I can say from experience that the IDE behaviors do not get in the way when you’re not writing code. In fact if anything they make typing normal text even easier. So I’d recommend that option is just left at false, so this is a non-issue.

most code on SO comes from people pasting in existing code, not writing new code

That’s probably true, but Behave.js even makes that experience better, since you generally aren’t pasting in code that already has the correct indentation. With Behave.js you can select all the code you just pasted in, and type Tab to increase the indentation, or Shift + Tab to decrease it, all at once. Saves a lot of time and frustration!

  • 1
    A couple of issues I see already: it's not clear that the code fencing support could be made to be consistent with markdown, and most code on SO comes from people pasting in existing code, not writing new code. – murgatroid99 Jul 25 '14 at 18:32
  • @murgatroid99 Good points, and I just updated my “question” with responses (bit too wordy for a comment). – Brandon Kelly Jul 25 '14 at 18:44
  • Yes, please. – Won't Jul 25 '14 at 19:07
  • 1
    One final point: the question/answer textareas are primarily used by people who are unfamiliar with Behave.js. For those users, Behave seems to introduce unexpected behaviors, primarily inserting extra characters. Do you think the UX cost of those unexpected behaviors is justified by the benefit of easier code editing? – murgatroid99 Jul 25 '14 at 19:34
  • @murgatroid99 The beauty of Behave.js is it’s incredibly simple and intuitive. I don’t think that there is a UX cost in the first place – I would consider it in the same category as credit card forms that automatically decipher which CC type you have by checking the first couple digits, saving you from having to click the Visa radio button. Maybe not always expected, but never a problem. – Brandon Kelly Jul 25 '14 at 19:58

You must log in to answer this question.

Browse other questions tagged .