Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I fold content in Github markdown?

How does github fold text blocks?

look at this issuecomment

like image 764
xiao luo Avatar asked Sep 07 '18 01:09

xiao luo


People also ask

Does Markdown support collapsible sections?

Short Answer: No, Markdown does not offer a feature like that directly, but with some work you might be able to build something that works. For a feature like that to work you would need some CSS and/or JavaScript to control the animations, etc.

How do I indent a paragraph in GitHub Markdown?

As a workaround I would suggest inserting a vertical bar (|) followed by hard spaces (Alt-Code on Windows: Alt+0160). This preserves the indent after the bar resulting in a visually acceptable solution for raw and rendered Markdown. This is a normal line of text. | This is an indented line of text.


2 Answers

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> 
like image 160
VonC Avatar answered Sep 24 '22 18:09

VonC


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> 
like image 20
Jacob Avatar answered Sep 21 '22 18:09

Jacob