Skip to content

Instantly share code, notes, and snippets.

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

How to

<details>
  <summary>Click me</summary>
  
  ### Heading
  1. Foo
  2. Bar
     * Baz
     * Qux

  ### Some Code
  ```js
  function logSomething(something) {
    console.log('Something', something);
  }
  ```
</details>

Example

Click me

Heading

  1. Foo
  2. Bar
    • Baz
    • Qux

Some Code

function logSomething(something) {
  console.log('Something', something);
}

Rules

  1. Have an empty line after the </summary> tag or markdown/code blocks will not render.
  2. Have an empty line after each </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