In 2016 there was a request “Collapsible contents (code block) in comments / spoiler tag” and a comment showed that this was possible already back then with the HTML syntax:
<details><summary>Click to expand</summary>Full content here.</details>
Instead of this valuable info being buried deep in an issue conversation, please add it to the official Syntax Reference on Github-flavored Markdown. This is linked to by the hint “Styling with Markdown is supported” below the UI for writing issues and comment, so the first stop for users informing themselves about the syntax.
And the ability to add longer code blocks without harassing your fellow readers with long scrolls is a legit syntax need, as the popularity of the issue shows.
So please to the chapter “Quoting code” add a sub-chapter “Collapsible code block (aka spoiler)” and there add this valuable information. Thanks.