Skip to content

Instantly share code, notes, and snippets.

@jbsulli
Last active May 20, 2025 20:50
Show Gist options
  • Save jbsulli/03df3cdce94ee97937ebda0ffef28287 to your computer and use it in GitHub Desktop.
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

@Be1zebub
Copy link

any ideas how to make discord/telegram like spoilers/hidden text?
image

@abraxas86
Copy link

any ideas how to make discord/telegram like spoilers/hidden text? image

In discord, you just smash your text between 2 sets of pipes, like this: ||This text will be hidden until the user clicks the blacked-out bar.||

Not sure about TG though

@Be1zebub
Copy link

In discord, you just smash your text between 2 sets of pipes, like this: ||This text will be hidden until the user clicks the blacked-out bar.||

Not sure about TG though

ty cap, but im askin how todo such spoiler in GFM

@abraxas86
Copy link

In discord, you just smash your text between 2 sets of pipes, like this: ||This text will be hidden until the user clicks the blacked-out bar.||
Not sure about TG though

ty cap, but im askin how todo such spoiler in GFM

Ohhh, my bad - I mis-read your post. I don't think GFM has a proper spoiler tag. Would be great if somebody smarter than me created an Ultimate Markdown that takes all the markdowns out there and starts as a script that lets you define your own markdown - the options you want, the way it behaves, and the syntax to trigger it. Like, if you wanted a spoiler that renders like Reddit's but triggers with Discord's syntax, you'd be able to.

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