Skip to content

Instantly share code, notes, and snippets.

@jbsulli
Last active March 9, 2026 08:00
Show Gist options
  • Select an option

  • Save jbsulli/03df3cdce94ee97937ebda0ffef28287 to your computer and use it in GitHub Desktop.

Select an option

Save jbsulli/03df3cdce94ee97937ebda0ffef28287 to your computer and use it in GitHub Desktop.

Demo:

Spoiler warning

Spoiler text. Note that it's important to have a space after the summary tag. You should be able to write any markdown you want inside the <details> tag... just make sure you close <details> afterward.

console.log("I'm a code block!");

How to:

<details>
  <summary>Spoiler warning</summary>
  
  Spoiler text. Note that it's important to have a space after the summary tag. You should be able to write any markdown you want inside the `<details>` tag... just make sure you close `<details>` afterward.
  
  ```javascript
  console.log("I'm a code block!");
  ```
  
</details>

Credits:

dear-github/dear-github#166

@EskeRahn
Copy link

EskeRahn commented Mar 9, 2026

If you combine the spoiler tag with quoting, then when expanded the vertical quote bar makes it is easier to see what can be collapsed

<details><summary></summary>

> whatever markdown....
> ``` SQL
> SELECT sqrt(sqrt(2143.0/22))
> ``` 
> blah blah....

</details>

blah blah after the collapsable section

renders like

whatever markdown....

SELECT sqrt(sqrt(2143.0/22))

blah blah....

blah blah after the collapsable section

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment