Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save a-laughlin/3dbd75dd4329304c660d923c65da5e93 to your computer and use it in GitHub Desktop.
Save a-laughlin/3dbd75dd4329304c660d923c65da5e93 to your computer and use it in GitHub Desktop.
How to add a collapsible section in markdown.

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 whatIsLove() {
    console.log('Baby Don't hurt me. Don't hurt me');
    return 'No more';
  }

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>

NB: Make sure you have an empty line after the closing </summary> tag, otherwise the markdown/code blocks won't show correctly.

NB: Make sure you have an empty line after the closing </details> tag if you have multiple collapsible sections.

@a-laughlin
Copy link
Author

a-laughlin commented May 8, 2021

test summary test body
test summary2 test body2

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