title | intro | product | versions | redirect_from | shortTitle | |||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Organizing information with collapsed sections | You can streamline your Markdown by creating a collapsed section with the `<details>` tag. | {% data reusables.gated-features.markdown-ui %} |
|
| Collapsed sections |
You can temporarily obscure sections of your Markdown by creating a collapsed section that the reader can choose to expand. For example, when you want to include technical details in an issue comment that may not be relevant or interesting to every reader, you can put those details in a collapsed section.
Any Markdown within the <details>
block will be collapsed until the reader clicks {% octicon "triangle-right" aria-label="The right triangle icon" %} to expand the details.
Within the <details>
block, use the <summary>
tag to let readers know what is inside. The label appears to the right of {% octicon "triangle-right" aria-label="The right triangle icon" %}.
<details> <summary>Tips for collapsed sections</summary> ### You can add a header You can add text within a collapsed section. You can add an image or a code block, too. ```rubyputs"Hello World"``` </details>
The Markdown inside the <summary>
label will be collapsed by default:
After a reader clicks {% octicon "triangle-right" aria-label="The right triangle icon" %}, the details are expanded:
Optionally, to make the section display as open by default, add the open
attribute to the <details>
tag:
<detailsopen>