Some questions contain long code listings, and it is often required to copy, download, or view the code in full, and maybe past/download it to a local file for compiler experiments.

Is there a better way for getting the code than doing tedious region select, scroll, and copy ?

Does it make sense to suggest some download link, or maybe copy link similar to the box appearing when pressing share for question or answer?; and how to make such a suggestion ?

  • There are about 3 potential duplicates in the Related widget ------------------>
    – brasofilo
    Dec 11, 2013 at 12:44
  • @brasofilo and Antony: OK, my searches missed relevant keywords; I will close the question ASAP. Dec 11, 2013 at 12:54

2 Answers 2


As you say, sometimes there can be a lot of code. The way I copy it is:

  1. Click Edit on the question, so I can view the markdown
  2. Copy the bits that I need from the raw source (CTRL+A, CTRL+C works too)
  3. Click Cancel to discard the edit.
  4. Then I just paste into my favorite editor.
  • I do the same thing. Dec 11, 2013 at 14:19

Download links are inconsistent with building up a standalone Q&A coding knowledge base.

Plus questions should submit a "Short Self-Contained Code Example". This therefore will be short and ought not to scroll.

So for a well-formed question this will not be a problem.

  • 2
    Sometimes it is very helpful to get longer code listings, for example to get the test bench that shows the problem in source code, so I don't think long code listings and standalone Q&A coding knowledge base are contradicting concepts. Dec 11, 2013 at 12:56
  • @mortenZdk 95% of the time a full example can still be short if it's cut down as much as possible Dec 11, 2013 at 12:58
  • But providing special tools to cover what are essentially edge cases would only encourage large code samples to be submitted in many other cases.
    – Bathsheba
    Dec 11, 2013 at 12:58

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