Skip to content

Commit

Permalink
Create new guide for use of collapsed sections (github#22517)
Browse files Browse the repository at this point in the history
  • Loading branch information
juanmrad authored Nov 16, 2021
1 parent 329a8c6 commit 7a11ccc
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 0 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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)"

0 comments on commit 7a11ccc

Please sign in to comment.