0

I often want to paste a code snippet into a SO question which has a hierarchical structure (indented with tabs):

<div class="some-class">
    <div class="some-class" style="width:130px;">
        <input class="some-class" />
    </div>
</div>

If I click "code sample" and paste the code, the result is

<div class="some-class">
<div class="some-class" style="width:130px;">
    <input class="some-class" />
</div>

Obviously, only the first line of code is indented. Couldn't this be changed to get a more consistent user experience?

0

1 Answer 1

3

I see; I think the issue here is the expectation that once you've started a code sample, subsequent newlines (including via paste) will continue to be automatically indented. Simply: that isn't what happens. However, if you just change the order, it will work fine.

  • paste the code (without worrying about indenting it)
  • select it
  • hit the code sample button or press ctrl+k

result: the entire thing indents correctly.

You must log in to answer this question.

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