githubmarkdownfoldinggithub-flavored-markdown

How can I fold content in Github markdown?


How does github fold text blocks?

look at this issuecomment


Solution

  • 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.