Skip to content

Instantly share code, notes, and snippets.

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

How to

<details>
  <summary>see this long example - click to expand </summary>
  
  You can use regular markdown formatting inside your collapsed section.
  
  ### Heading
  1. Foo
  2. Bar
     * Baz
     * Qux

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

Example

see this long example - click to expand

You can use regular markdown formatting inside your collapsed section.

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