Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save eliot-cole/674d0f8058a7297642fb8c50fc4813a7 to your computer and use it in GitHub Desktop.

Select an option

Save eliot-cole/674d0f8058a7297642fb8c50fc4813a7 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

@eliot-cole
Copy link
Copy Markdown
Author

Test comment before posting upstream! ๐Ÿ˜…

FYI ... I think that the space thing has largely been resolved ... as I've used these in lists (both ordered and unordered) in the past. ๐Ÿ‘
I think it is only required if you are including markdown inside the spoiler.

I accept that this may have been the whole purpose of this gist, given the title, but ... just thought I'd mention it.

How To

Working with the example above ...

Visual

Spoiler warningSpoiler 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>... just make sure you close </details> afterward.
console.log("I'm a code block!");

Code

<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 <code>&lt;details&gt;</code>... just make sure you close <code>&lt;/details&gt;</code> afterward.<pre lang="javascript"><code>console.log("I'm a code block!");</code></pre></details>

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