Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save barkode/f1572fef2661e91b661ca08a0ef8c2b3 to your computer and use it in GitHub Desktop.
Save barkode/f1572fef2661e91b661ca08a0ef8c2b3 to your computer and use it in GitHub Desktop.

Revisions

  1. @pierrejoubert73 pierrejoubert73 revised this gist Mar 5, 2024. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion markdown-details-collapsible.md
    Original file line number Diff line number Diff line change
    @@ -39,7 +39,6 @@
    ````

    ## 3. Tips & Tricks
    Discover some handy customizations for your collapsible sections.

    ### 3.1 Expand by Default
    To have a collapsible section expanded by default, simply include the 'open' attribute within the `<details>` tag:
  2. @pierrejoubert73 pierrejoubert73 revised this gist Aug 17, 2023. 1 changed file with 14 additions and 13 deletions.
    27 changes: 14 additions & 13 deletions markdown-details-collapsible.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    # How to add a collapsible section in markdown
    # 1. Example
    ## 1. Example
    <details>
    <summary>Click me</summary>

    @@ -18,7 +18,7 @@
    </details>


    # 2. Code/Markdown
    ## 2. Code/Markdown
    ````md
    <details>
    <summary>Click me</summary>
    @@ -38,11 +38,11 @@
    </details>
    ````

    # 3. Tips & Tricks
    A couple neat things you can do to customize your collapsible sections.
    ## 3. Tips & Tricks
    Discover some handy customizations for your collapsible sections.

    ### 3.1 Expand by default
    A collapsible section can be expanded by default. Simply add 'open' in the `<details>` tag:
    ### 3.1 Expand by Default
    To have a collapsible section expanded by default, simply include the 'open' attribute within the `<details>` tag:

    <details open>
    <summary>Hello</summary>
    @@ -56,8 +56,8 @@ A collapsible section can be expanded by default. Simply add 'open' in the `<det
    </details>
    ```

    ### 3.2 Customize clickable text
    You can change what the clickable text looks like by adding styling inside of the `<summary>` tags:
    ### 3.2 Customize Clickable Text
    You can modify the appearance of the clickable text by adding styling inside the `<summary>` tags:

    <details>
    <summary><i>Wow, so fancy</i></summary>
    @@ -71,8 +71,9 @@ You can change what the clickable text looks like by adding styling inside of th
    </details>
    ```

    ### 3.3 Nested collapsible sections
    When adding headings inside of your collapsible sections,remember to add a new line after the `<summary>` tag.
    ### 3.3 Nested Collapsible Sections
    NB: When including headings within collapsible sections, remember to add a new line after the `<summary>` tag.

    <details>
    <summary>Section A</summary>
    <details>
    @@ -103,6 +104,6 @@ When adding headings inside of your collapsible sections,remember to add a new l
    </details>
    ```

    # Troubleshooting
    * If some markdown or styling such as `# My Title` does not render in the collpsible section, try adding a break after the `</summary>` tag.
    * If your section does not render, it's probably malformed. Try copying the working examples here and work from there!
    ## Troubleshooting
    - If certain markdown or styling, such as `# My Title`, fails to render in the collapsible section, try adding a line break after the `</summary>` tag.
    - If your section fails to render, it might be malformed. Consider copying the functional examples provided here and building from there!
  3. @pierrejoubert73 pierrejoubert73 revised this gist Aug 17, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion markdown-details-collapsible.md
    Original file line number Diff line number Diff line change
    @@ -57,7 +57,7 @@ A collapsible section can be expanded by default. Simply add 'open' in the `<det
    ```

    ### 3.2 Customize clickable text
    You can change what the clickable text looks like by adding markup inside of the `<summary>` tags:
    You can change what the clickable text looks like by adding styling inside of the `<summary>` tags:

    <details>
    <summary><i>Wow, so fancy</i></summary>
  4. @pierrejoubert73 pierrejoubert73 revised this gist Aug 17, 2023. No changes.
  5. @pierrejoubert73 pierrejoubert73 revised this gist Aug 17, 2023. 1 changed file with 5 additions and 9 deletions.
    14 changes: 5 additions & 9 deletions markdown-details-collapsible.md
    Original file line number Diff line number Diff line change
    @@ -42,18 +42,16 @@
    A couple neat things you can do to customize your collapsible sections.

    ### 3.1 Expand by default
    You instruct a collapsible section to be expanded by default. Simply add 'open' in the details tag:
    A collapsible section can be expanded by default. Simply add 'open' in the `<details>` tag:

    <details open>
    <summary>Hello</summary>

    World!
    </details>

    ```
    <details open>
    <summary>Hello</summary>
    World!
    </details>
    ```
    @@ -63,20 +61,18 @@ You can change what the clickable text looks like by adding markup inside of the

    <details>
    <summary><i>Wow, so fancy</i></summary>

    <b>WOW, SO BOLD</b>
    </details>

    ```
    <details>
    <summary><i>Wow, so fancy</i></summary>
    <b>WOW, SO BOLD</b>
    </details>
    ```

    ### 3.3 Nested collapsible sections
    When adding markup inside of your collapsible sections,remember to add the proper spacing before and after the `<details>` and `<summary>` tags. See the [rules](#rules) section.
    When adding headings inside of your collapsible sections,remember to add a new line after the `<summary>` tag.
    <details>
    <summary>Section A</summary>
    <details>
    @@ -107,6 +103,6 @@ When adding markup inside of your collapsible sections,remember to add the prope
    </details>
    ```

    # Rules (If you don't do this, your code may not work)
    1. Always have an **empty line** after the `</summary>` tag
    1. Always have an **empty line** after each `</details>` tag
    # Troubleshooting
    * If some markdown or styling such as `# My Title` does not render in the collpsible section, try adding a break after the `</summary>` tag.
    * If your section does not render, it's probably malformed. Try copying the working examples here and work from there!
  6. @pierrejoubert73 pierrejoubert73 revised this gist Aug 17, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion markdown-details-collapsible.md
    Original file line number Diff line number Diff line change
    @@ -42,7 +42,7 @@
    A couple neat things you can do to customize your collapsible sections.

    ### 3.1 Expand by default
    You instrcut tell a collapsible section to be expanded by default. Simply add 'open' in the details tag:
    You instruct a collapsible section to be expanded by default. Simply add 'open' in the details tag:

    <details open>
    <summary>Hello</summary>
  7. @pierrejoubert73 pierrejoubert73 revised this gist Aug 17, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion markdown-details-collapsible.md
    Original file line number Diff line number Diff line change
    @@ -42,7 +42,7 @@
    A couple neat things you can do to customize your collapsible sections.

    ### 3.1 Expand by default
    The collapsible section can expanded by default. Simply add 'open' in your details tag:
    You instrcut tell a collapsible section to be expanded by default. Simply add 'open' in the details tag:

    <details open>
    <summary>Hello</summary>
  8. @pierrejoubert73 pierrejoubert73 revised this gist Aug 17, 2023. 1 changed file with 65 additions and 13 deletions.
    78 changes: 65 additions & 13 deletions markdown-details-collapsible.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    # How to add a collapsible section in markdown.
    ## Example
    # How to add a collapsible section in markdown
    # 1. Example
    <details>
    <summary>Click me</summary>

    @@ -9,7 +9,7 @@
    * Baz
    * Qux

    ### Some Code
    ### Some Javascript
    ```js
    function logSomething(something) {
    console.log('Something', something);
    @@ -18,7 +18,7 @@
    </details>


    ## Code
    # 2. Code/Markdown
    ````md
    <details>
    <summary>Click me</summary>
    @@ -29,7 +29,7 @@
    * Baz
    * Qux

    ### Some Code
    ### Some Javascript
    ```js
    function logSomething(something) {
    console.log('Something', something);
    @@ -38,23 +38,75 @@
    </details>
    ````

    ## Tips & Tricks (WIP)
    ### Expand by default
    # 3. Tips & Tricks
    A couple neat things you can do to customize your collapsible sections.

    ### 3.1 Expand by default
    The collapsible section can expanded by default. Simply add 'open' in your details tag:

    <details open>
    <summary>Hello</summary>

    World!
    </details>

    ```
    <details open>
    ...
    <summary>Hello</summary>
    World!
    </details>
    ```

    ### Customize clickable text
    ### 3.2 Customize clickable text
    You can change what the clickable text looks like by adding markup inside of the `<summary>` tags:

    <details>
    <summary><i>Wow, so fancy</i></summary>

    <b>WOW, SO BOLD</b>
    </details>

    ```
    ...
    <summary><h1>IMPORTANT INFO</h1></summary>
    ...
    <details>
    <summary><i>Wow, so fancy</i></summary>
    <b>WOW, SO BOLD</b>
    </details>
    ```

    ### 3.3 Nested collapsible sections
    When adding markup inside of your collapsible sections,remember to add the proper spacing before and after the `<details>` and `<summary>` tags. See the [rules](#rules) section.
    <details>
    <summary>Section A</summary>
    <details>
    <summary>Section A.B</summary>
    <details>
    <summary>Section A.B.C</summary>
    <details>
    <summary>Section A.B.C.D</summary>
    Done!
    </details>
    </details>
    </details>
    </details>

    ```
    <details>
    <summary>Section A</summary>
    <details>
    <summary>Section A.B</summary>
    <details>
    <summary>Section A.B.C</summary>
    <details>
    <summary>Section A.B.C.D</summary>
    Done!
    </details>
    </details>
    </details>
    </details>
    ```

    ## Rules (If you don't do this, your code may not work)
    # Rules (If you don't do this, your code may not work)
    1. Always have an **empty line** after the `</summary>` tag
    1. Always have an **empty line** after each `</details>` tag
  9. @pierrejoubert73 pierrejoubert73 revised this gist Aug 17, 2023. 1 changed file with 8 additions and 0 deletions.
    8 changes: 8 additions & 0 deletions markdown-details-collapsible.md
    Original file line number Diff line number Diff line change
    @@ -47,6 +47,14 @@ The collapsible section can expanded by default. Simply add 'open' in your detai
    </details>
    ```

    ### Customize clickable text
    You can change what the clickable text looks like by adding markup inside of the `<summary>` tags:
    ```
    ...
    <summary><h1>IMPORTANT INFO</h1></summary>
    ...
    ```

    ## Rules (If you don't do this, your code may not work)
    1. Always have an **empty line** after the `</summary>` tag
    1. Always have an **empty line** after each `</details>` tag
  10. @pierrejoubert73 pierrejoubert73 revised this gist Aug 17, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion markdown-details-collapsible.md
    Original file line number Diff line number Diff line change
    @@ -38,7 +38,7 @@
    </details>
    ````

    ## Tips
    ## Tips & Tricks (WIP)
    ### Expand by default
    The collapsible section can expanded by default. Simply add 'open' in your details tag:
    ```
  11. @pierrejoubert73 pierrejoubert73 revised this gist Aug 17, 2023. 1 changed file with 7 additions and 1 deletion.
    8 changes: 7 additions & 1 deletion markdown-details-collapsible.md
    Original file line number Diff line number Diff line change
    @@ -39,7 +39,13 @@
    ````

    ## Tips
    1. Expand by default - The collapsible section can expanded by default. Simply add 'open' in your details tag: `<details open>`
    ### Expand by default
    The collapsible section can expanded by default. Simply add 'open' in your details tag:
    ```
    <details open>
    ...
    </details>
    ```

    ## Rules (If you don't do this, your code may not work)
    1. Always have an **empty line** after the `</summary>` tag
  12. @pierrejoubert73 pierrejoubert73 revised this gist Aug 17, 2023. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions markdown-details-collapsible.md
    Original file line number Diff line number Diff line change
    @@ -38,6 +38,9 @@
    </details>
    ````

    ## Tips
    1. Expand by default - The collapsible section can expanded by default. Simply add 'open' in your details tag: `<details open>`

    ## Rules (If you don't do this, your code may not work)
    1. Always have an **empty line** after the `</summary>` tag
    1. Always have an **empty line** after each `</details>` tag
  13. @pierrejoubert73 pierrejoubert73 revised this gist May 9, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion markdown-details-collapsible.md
    Original file line number Diff line number Diff line change
    @@ -8,7 +8,7 @@
    2. Bar
    * Baz
    * Qux

    ### Some Code
    ```js
    function logSomething(something) {
  14. @pierrejoubert73 pierrejoubert73 revised this gist May 9, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion markdown-details-collapsible.md
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    # How to add a collapsible section in markdown.
    ## Example
    <details>
    <summary>Click me</summary>
    <summary>Click me</summary>

    ### Heading
    1. Foo
  15. @pierrejoubert73 pierrejoubert73 revised this gist May 9, 2023. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions markdown-details-collapsible.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,4 @@
    # How to add a collapsible section in markdown.
    ## Example
    <details>
    <summary>Click me</summary>
  16. @pierrejoubert73 pierrejoubert73 revised this gist May 9, 2023. 1 changed file with 14 additions and 13 deletions.
    27 changes: 14 additions & 13 deletions markdown-details-collapsible.md
    Original file line number Diff line number Diff line change
    @@ -1,41 +1,42 @@
    ## How to
    ````md
    ## Example
    <details>
    <summary>Click me</summary>
    <summary>Click me</summary>

    ### Heading
    1. Foo
    2. Bar
    * Baz
    * Qux

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

    ## Example
    <details>
    <summary>Click me</summary>

    ## Code
    ````md
    <details>
    <summary>Click me</summary>

    ### Heading
    1. Foo
    2. Bar
    * Baz
    * Qux

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

    ## Rules
    1. Have an **empty line** after the `</summary>` tag or markdown/code blocks will not render.
    1. Have an **empty line** after each `</details>` tag if you have multiple collapsible sections.
    ## Rules (If you don't do this, your code may not work)
    1. Always have an **empty line** after the `</summary>` tag
    1. Always have an **empty line** after each `</details>` tag
  17. @pierrejoubert73 pierrejoubert73 revised this gist Aug 10, 2022. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions markdown-details-collapsible.md
    Original file line number Diff line number Diff line change
    @@ -37,5 +37,5 @@
    </details>

    ## Rules
    1. Have an **empty line** after the closing `</summary>` tag or Markdown/code blocks will not render.
    1. Have an **empty line** after the closing `</details>` tag if you have multiple collapsible sections after one another.
    1. Have an **empty line** after the `</summary>` tag or markdown/code blocks will not render.
    1. Have an **empty line** after each `</details>` tag if you have multiple collapsible sections.
  18. @pierrejoubert73 pierrejoubert73 revised this gist Aug 10, 2022. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions markdown-details-collapsible.md
    Original file line number Diff line number Diff line change
    @@ -11,7 +11,7 @@

    ### Some Code
    ```js
    function logSometing(something) {
    function logSomething(something) {
    console.log('Something', something);
    }
    ```
    @@ -30,7 +30,7 @@

    ### Some Code
    ```js
    function logSometing(something) {
    function logSomething(something) {
    console.log('Something', something);
    }
    ```
  19. @pierrejoubert73 pierrejoubert73 revised this gist Aug 10, 2022. 1 changed file with 6 additions and 6 deletions.
    12 changes: 6 additions & 6 deletions markdown-details-collapsible.md
    Original file line number Diff line number Diff line change
    @@ -11,9 +11,9 @@

    ### Some Code
    ```js
    function logSometing(something) {
    console.log('Something', something);
    }
    function logSometing(something) {
    console.log('Something', something);
    }
    ```
    </details>
    ````
    @@ -30,9 +30,9 @@

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

  20. @pierrejoubert73 pierrejoubert73 revised this gist Aug 10, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion markdown-details-collapsible.md
    Original file line number Diff line number Diff line change
    @@ -31,7 +31,7 @@
    ### Some Code
    ```js
    function logSometing(something) {
    console.log(`Logging: ${something}`);
    console.log('Something', something);
    }
    ```
    </details>
  21. @pierrejoubert73 pierrejoubert73 revised this gist Aug 10, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion markdown-details-collapsible.md
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    ## How to
    ````md
    <details>
    <summary>Click to expand!</summary>
    <summary>Click me</summary>

    ### Heading
    1. Foo
  22. @pierrejoubert73 pierrejoubert73 revised this gist Aug 10, 2022. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions markdown-details-collapsible.md
    Original file line number Diff line number Diff line change
    @@ -6,8 +6,8 @@
    ### Heading
    1. Foo
    2. Bar
    * Baz
    * Qux
    * Baz
    * Qux

    ### Some Code
    ```js
    @@ -25,8 +25,8 @@
    ### Heading
    1. Foo
    2. Bar
    * Baz
    * Qux
    * Baz
    * Qux

    ### Some Code
    ```js
  23. @pierrejoubert73 pierrejoubert73 revised this gist Aug 10, 2022. 1 changed file with 29 additions and 26 deletions.
    55 changes: 29 additions & 26 deletions markdown-details-collapsible.md
    Original file line number Diff line number Diff line change
    @@ -1,38 +1,41 @@
    # A collapsible section containing markdown
    ## How to
    ````md
    <details>
    <summary>Click to expand!</summary>

    ## Heading
    1. A numbered
    2. list
    * With some
    * Sub bullets
    ### Heading
    1. Foo
    2. Bar
    * Baz
    * Qux

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

    # A collapsible section containing code
    ## Example
    <details>
    <summary>Click to expand!</summary>

    ```javascript
    <summary>Click me</summary>

    ### Heading
    1. Foo
    2. Bar
    * Baz
    * Qux

    ### Some Code
    ```js
    function logSometing(something) {
    console.log(`Logging: ${something}`);
    }
    ```
    </details>

    # 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.
    ## Rules
    1. Have an **empty line** after the closing `</summary>` tag or Markdown/code blocks will not render.
    1. Have an **empty line** after the closing `</details>` tag if you have multiple collapsible sections after one another.
  24. @pierrejoubert73 pierrejoubert73 revised this gist Jul 8, 2021. 1 changed file with 5 additions and 6 deletions.
    11 changes: 5 additions & 6 deletions markdown-details-collapsible.md
    Original file line number Diff line number Diff line change
    @@ -14,9 +14,8 @@
    <summary>Click to expand!</summary>

    ```javascript
    function whatIsLove() {
    console.log('Baby Don't hurt me. Don't hurt me');
    return 'No more';
    function logSometing(something) {
    console.log(`Logging: ${something}`);
    }
    ```
    </details>
    @@ -34,6 +33,6 @@
    * 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.
    **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.
  25. @pierrejoubert73 pierrejoubert73 revised this gist Dec 10, 2019. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions markdown-details-collapsible.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    # A collapsible section with markdown
    # A collapsible section containing markdown
    <details>
    <summary>Click to expand!</summary>

    @@ -9,7 +9,7 @@
    * Sub bullets
    </details>

    # A collapsible section with code
    # A collapsible section containing code
    <details>
    <summary>Click to expand!</summary>

    @@ -21,7 +21,7 @@
    ```
    </details>

    # How to structure the markup
    # How to structure
    ```
    # A collapsible section with markdown
    <details>
    @@ -34,6 +34,6 @@
    * Sub bullets
    </details>
    ```
    **NB:** Make sure you have an **empty line** after the closing `</summary>` tag.
    **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.
  26. @pierrejoubert73 pierrejoubert73 revised this gist Oct 11, 2018. 1 changed file with 38 additions and 6 deletions.
    44 changes: 38 additions & 6 deletions markdown-details-collapsible.md
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,39 @@
    Your markdown heading here
    # A collapsible section with markdown
    <details>
    <summary>
    Show details
    </summary>
    Your markdown content here
    </details>
    <summary>Click to expand!</summary>

    ## Heading
    1. A numbered
    2. list
    * With some
    * Sub bullets
    </details>

    # A collapsible section with code
    <details>
    <summary>Click to expand!</summary>

    ```javascript
    function whatIsLove() {
    console.log('Baby Don't hurt me. Don't hurt me');
    return 'No more';
    }
    ```
    </details>

    # How to structure the markup
    ```
    # 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.

    **NB**: Make sure you have an **empty line** after the closing `</details>` tag if you have multiple collapsible sections.
  27. @pierrejoubert73 pierrejoubert73 created this gist Jun 30, 2017.
    7 changes: 7 additions & 0 deletions markdown-details-collapsible.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    Your markdown heading here
    <details>
    <summary>
    Show details
    </summary>
    Your markdown content here
    </details>