1
0
mirror of synced 2025-12-23 03:44:00 -05:00

Create new guide for use of collapsed sections (#22517)

This commit is contained in:
Juan Mrad
2021-11-16 13:18:21 -06:00
committed by GitHub
parent 329a8c664e
commit 7a11ccc229
4 changed files with 43 additions and 0 deletions

View File

@@ -10,6 +10,7 @@ versions:
ghec: '*'
children:
- /organizing-information-with-tables
- /organizing-information-with-collapsed-sections
- /creating-and-highlighting-code-blocks
- /autolinked-references-and-urls
- /attaching-files

View File

@@ -0,0 +1,42 @@
---
title: Organizing information with collapsed sections
intro: 'You can streamline your Markdown by creating a collapsed section with the `<details>` tag.'
versions:
fpt: '*'
ghes: '*'
ghae: '*'
ghec: '*'
shortTitle: Collapsed sections
---
## Creating a collapsed section
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 triange icon" %} to expand the details. Within the `<details>` block, use the `<summary>` tag to create a label to the right of {% octicon "triangle-right" aria-label="The right triange icon" %}.
```markdown
<details><summary>CLICK ME</summary>
<p>
#### We can hide anything, even code!
```ruby
puts "Hello World"
```
</p>
</details>
```
The Markdown will be collapsed by default.
![Rendered collapsed](/assets/images/help/writing/collapsed-section-view.png)
After a reader clicks {% octicon "triangle-right" aria-label="The right triange icon" %}, the details are expanded.
![Rendered open](/assets/images/help/writing/open-collapsed-section.png)
## Further reading
- [{% data variables.product.prodname_dotcom %} Flavored Markdown Spec](https://github.github.com/gfm/)
- "[Basic writing and formatting syntax](/articles/basic-writing-and-formatting-syntax)"