Skip to content

Commit 2142303

Browse files
authored
Merge pull request #12062 from github/repo-sync
repo sync
2 parents c593a0f + 9a37b05 commit 2142303

4 files changed

Lines changed: 43 additions & 0 deletions

File tree

8.07 KB
Loading
26.1 KB
Loading

content/github/writing-on-github/working-with-advanced-formatting/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ versions:
1010
ghec: '*'
1111
children:
1212
- /organizing-information-with-tables
13+
- /organizing-information-with-collapsed-sections
1314
- /creating-and-highlighting-code-blocks
1415
- /autolinked-references-and-urls
1516
- /attaching-files
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
title: Organizing information with collapsed sections
3+
intro: 'You can streamline your Markdown by creating a collapsed section with the `<details>` tag.'
4+
versions:
5+
fpt: '*'
6+
ghes: '*'
7+
ghae: '*'
8+
ghec: '*'
9+
shortTitle: Collapsed sections
10+
---
11+
## Creating a collapsed section
12+
13+
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.
14+
15+
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" %}.
16+
17+
```markdown
18+
<details><summary>CLICK ME</summary>
19+
<p>
20+
21+
#### We can hide anything, even code!
22+
23+
```ruby
24+
puts "Hello World"
25+
```
26+
27+
</p>
28+
</details>
29+
```
30+
31+
The Markdown will be collapsed by default.
32+
33+
![Rendered collapsed](/assets/images/help/writing/collapsed-section-view.png)
34+
35+
After a reader clicks {% octicon "triangle-right" aria-label="The right triange icon" %}, the details are expanded.
36+
37+
![Rendered open](/assets/images/help/writing/open-collapsed-section.png)
38+
39+
## Further reading
40+
41+
- [{% data variables.product.prodname_dotcom %} Flavored Markdown Spec](https://github.github.com/gfm/)
42+
- "[Basic writing and formatting syntax](/articles/basic-writing-and-formatting-syntax)"

0 commit comments

Comments
 (0)