Skip to content

Instantly share code, notes, and snippets.

@bitroniq
Last active May 12, 2022 18:38
Show Gist options
  • Save bitroniq/035f2c4b30b676856ca92fd82066752e to your computer and use it in GitHub Desktop.
Save bitroniq/035f2c4b30b676856ca92fd82066752e to your computer and use it in GitHub Desktop.
Foldable Markdown example

A collapsible section containing markdown

Click to expand!

Heading

  1. A numbered
  2. list
    • With some
    • Sub bullets

A collapsible section containing code

Click to expand!
  function logSometing(something) {
    console.log(`Logging: ${something}`);
  }

How to structure

# A collapsible section with markdown

<details>
  <summary>Click to expand!</summary>
  
  ## Heading
  1. A numbered
  2. list
     * With some
     * Sub bullets
</details>

Two important rules:

  1. Make sure you have an empty line after the closing </summary> tag, otherwise the markdown/code blocks won't show correctly.
  2. Make sure you have an empty line after the closing </details> tag if you have multiple collapsible sections.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment