Click-to-show code snippets

Some of the posts I’ve read contain code snippets which are not visible by default, requiring a “Click” to show up. How can one obtain such a feature? I checked FAQ but it is about completely different topics (“be polite etc.”). There are (unless I miss something obvious) no help page covering technical topics of editing the posts.

3 Likes

It is called a “Details disclosure element”.

You can type it directly in HTML:

<details>
    <summary>Details</summary>
    Something small enough to escape casual notice.
</details>

Appearance:

Details Something small enough to escape casual notice.

You can also find it under the “gear” tool tab as “Hide Details”.

The syntax is slightly different:

[details="Summary"]
This text will be hidden
[/details]
Summary

This text will be hidden

4 Likes