Skip to content

Commit 901d86b

Browse files
authored
Merge branch 'main' into repo-sync
2 parents c593a0f + b1bbafe commit 901d86b

5 files changed

Lines changed: 73 additions & 5 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)"

lib/failbot.js

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,46 @@
11
import got from 'got'
2-
import { Failbot, HTTPBackend, LogBackend } from '@github/failbot'
2+
import { Failbot, HTTPBackend } from '@github/failbot'
33

44
const HAYSTACK_APP = 'docs'
55

6+
async function retryingGot(url, args) {
7+
return got(
8+
url,
9+
Object.assign({}, args, {
10+
// With the timeout at 3000 (milliseconds) and the retry.limit
11+
// at 4 (times), the total worst-case is:
12+
// 3000 * 4 + 1000 + 2000 + 3000 + 4000 + 8000 = 30 seconds
13+
timeout: 3000,
14+
retry: {
15+
// This means it will wait...
16+
// 1. 1000ms
17+
// 2. 2000ms
18+
// 3. 4000ms
19+
// 4. 8000ms
20+
// 5. give up!
21+
//
22+
// From the documentation:
23+
//
24+
// Delays between retries counts with function
25+
// 1000 * Math.pow(2, retry - 1) + Math.random() * 100,
26+
// where retry is attempt number (starts from 1).
27+
//
28+
limit: 4,
29+
},
30+
})
31+
)
32+
}
33+
634
export function report(error, metadata) {
735
// If there's no HAYSTACK_URL set, bail early
836
if (!process.env.HAYSTACK_URL) return
937

1038
const backends = [
1139
new HTTPBackend({
1240
haystackURL: process.env.HAYSTACK_URL,
13-
fetchFn: got,
41+
fetchFn: retryingGot,
1442
}),
1543
]
16-
if (process.env.NODE_ENV !== 'test') {
17-
backends.push(new LogBackend({ log: console.log.bind(console) }))
18-
}
1944
const failbot = new Failbot({
2045
app: HAYSTACK_APP,
2146
backends: backends,

0 commit comments

Comments
 (0)