Here is a quick snippet to make collapsible sections in Github Flavoured Markdown.
Code:
<details>
<summary>
This is content that is only shown when collapsed.
</summary>
<p>This is content when this element is expanded.</p>
</details>
Preview:
This is content that is only shown when collapsed.
This is content when this element is expanded.