Sometimes when writing answers on questions, I feel the need for a collapsible block of text or even code part.
The system already supports a lot of markup things like blockquotes, code snippets, headings, etc... And I think it would be a great improvement if we could make a collapsible block of text that has a label in it, something that would look like:
> <Label of text or code block> (click to expand)
And when you click it looks like:
v <Label of text or code block> (click to collapse)
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec egestas tellus et sapien luctus tristique vel id felis. Morbi non velit et elit gravida iaculis. In lacinia elit in sem porttitor et varius tellus egestas. Ut nibh nisi, adipiscing vel fermentum eget, dapibus a lorem. Integer fringilla lorem porta libero mattis quis aliquet neque tincidunt. Fusce cursus rutrum lacus, id porta odio condimentum eu. Proin suscipit lacus et mi ornare volutpat. Fusce eros lacus, tempor at facilisis vel, varius eget massa.
For a list of possible use cases:
Different parts of code can be collapsed. This can make the answer shorter if you need to view only one thing at a time. For example: an answer contains interleaved blocks of HTML, javascript and CSS. The author may only wish to see the HTML parts first and get them right. He collapses the CSS and javascript parts.
An answer may consist of the essential part that answers the question, and a further detailed explanation here and there. Not everyone will want to read those, but it makes the answer more complete.
The answer links to a resource, but we all know what link rot is. The user copies the most imporant parts in his answer, but that may be a lot of text, so he collapses it by default.
A question may contain details of which the OP is not sure they are important. Examples include: system specs on superuser, a list of the versions of frameworks/libraries used on SO, etc.
A lot of code may be contained in the question itself. Of course, I fully agree that the OP should do the best he can to limit the code to the parts that matter, but sometimes it's inevitable because of how it is structured. Then, the code may be split up into collapsible blocks. For example; one might collapse a method/function, where the label contains the method header or function definition.
Other Stack Exchange sites: These collapsible blocks may be used to hide spoilers. I think of Scifi, but also maybe code golf & programminging challenges, to give hints.
In general when a question is very long, it may discourage people to read it. Those collapsible blocks could make it more digestive, and will also allow answerers who are willing to read, to view different parts at a time to make it easier to solve a problem.
Other suggestions are welcome.
status-declined
: meta.stackexchange.com/q/5199/147640