Skip to main content
Commonmark migration
Source Link

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.

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.

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.

Post Closed as "exact duplicate" by Adam LearStaffMod
Notice removed Canonical answer required by Adam LearStaffMod
added list of use cases.
Source Link
MarioDS
  • 1.7k
  • 12
  • 23

I had a question on SuperUser ( Passing links (http, mail...) between applications is slow ) and within the first few "versions" I was still looking for the exact cause of the problem.

Upon finding that cause, a lot of information that was previously in the question became obsolete, it just didn't apply anymore. Most of this information was "suspicion" of what the cause of the problem was, things I had already considered (please check the revisions to see what I mean).

NowSometimes when writing the update (I made a heading for it)answers on questions, I deleted quite a bit chunk of the question that is now not directly visible anymore (only infeel the revision history). What I felt would be quiteneed for a lot better was if I was able to collapse that now-obsolete information with some sortcollapsible block of markup, and label it as "old"text or even code part.

> <Label of text or code block> (click to expand)

v <Label of text or code block> (click to collapse)

It looks good and I think it would not be too heavy to implement, since it is purelyFor a frontend feature.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.

I had a question on SuperUser ( Passing links (http, mail...) between applications is slow ) and within the first few "versions" I was still looking for the exact cause of the problem.

Upon finding that cause, a lot of information that was previously in the question became obsolete, it just didn't apply anymore. Most of this information was "suspicion" of what the cause of the problem was, things I had already considered (please check the revisions to see what I mean).

Now when writing the update (I made a heading for it), I deleted quite a bit chunk of the question that is now not directly visible anymore (only in the revision history). What I felt would be quite a lot better was if I was able to collapse that now-obsolete information with some sort of markup, and label it as "old".

> <Label of text block> (click to expand)

v <Label of text block> (click to collapse)

It looks good and I think it would not be too heavy to implement, since it is purely a frontend feature.

Sometimes when writing answers on questions, I feel the need for a collapsible block of text or even code part.

> <Label of text or code block> (click to expand)

v <Label of text or code block> (click to collapse)

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.

Notice added Canonical answer required by MarioDS
Source Link
MarioDS
  • 1.7k
  • 12
  • 23

Collapsible text blocks in questions/answers

I had a question on SuperUser ( Passing links (http, mail...) between applications is slow ) and within the first few "versions" I was still looking for the exact cause of the problem.

Upon finding that cause, a lot of information that was previously in the question became obsolete, it just didn't apply anymore. Most of this information was "suspicion" of what the cause of the problem was, things I had already considered (please check the revisions to see what I mean).

Now when writing the update (I made a heading for it), I deleted quite a bit chunk of the question that is now not directly visible anymore (only in the revision history). What I felt would be quite a lot better was if I was able to collapse that now-obsolete information with some sort of markup, and label it as "old".

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 block> (click to expand)

And when you click it looks like:

v <Label of text 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.

It looks good and I think it would not be too heavy to implement, since it is purely a frontend feature.