90

How does github fold text blocks?

look at this issuecomment

0

2 Answers 2

124

Check if this follows dear-github issue 166, which mentions:

collapsible sections are supported:

<details>
<summary>Click to expand</summary>

whatever

</details>

See more in this example.

The key is to wrap the whole contents inside the <p>:

<details><summary>stuff with *mark* **down**</summary><p>

## _formatted_ **heading** with [a](link)

---
{{standard 3-backtick code block omitted from here due to escaping issues}}
---

Collapsible until here.
</p></details>

Gabriel Devillers reports in the comments that GitLab also have a similar collapsible section support.

Sign up to request clarification or add additional context in comments.

3 Comments

If you want to wrap only a code block, you can leave out the ---; you'll just need the fenced code block with an empty line before and after inside the <p>.
This also works in GitLab.
@GabrielDevillers Thank you your feedback. I have included your comment in the answer for more visibility.
19

You can start the folded sections expanded by default as well.

<details open>

  <summary>click to collapse</summary>

  this one starts expanded because of the "open"

</details>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.