Sometimes only 10 lines of 100 are relevant to the question/answer, the other 90 are setup.

Is there a way to hide 90 those in lines in the answer?

  • I proposed a solution here. Maybe you can argue that's the same question but I guess I didn't think of that until after I posted it. Doh
    – gman
    Commented Sep 17, 2014 at 10:04
  • I had proposed a solution @MSO
    – T J
    Commented Oct 2, 2014 at 13:50

1 Answer 1


The way to do this is just to include the 10 lines like you normally would.

Then in the Stack Snippet you place the full code. So the 10 lines will appear twice in the markup. One time before the snippet starts, and one time in the snippet.

Then make sure to check mark the box to hide the snippet by default, as shown below :

enter image description here

For a working example of this, see my answer that does just this here

  • 2
    not very D.R.Y.
    – gman
    Commented Sep 17, 2014 at 9:58
  • The question title reads "How do I select which lines of code to show and which lines to hide?" - from the snippet. Currently there is no option for that. Copy pasting isn't a practical solution for larger amount of code...
    – T J
    Commented Oct 2, 2014 at 15:23

You must log in to answer this question.

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