Skip to content

Instantly share code, notes, and snippets.

@scmx
Last active October 20, 2025 17:05
Show Gist options
  • Save scmx/eca72d44afee0113ceb0349dd54a84a2 to your computer and use it in GitHub Desktop.
Save scmx/eca72d44afee0113ceb0349dd54a84a2 to your computer and use it in GitHub Desktop.

Revisions

  1. scmx revised this gist Mar 10, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion using-details-summary-github.md
    Original file line number Diff line number Diff line change
    @@ -20,7 +20,7 @@ Answer: No, but you don't need it, since [GFM allows embedding HTML inside Markd

    #### Example

    <details>
    <details open>
    <summary>Shopping list</summary>

    * Vegetables
  2. scmx revised this gist Mar 10, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion using-details-summary-github.md
    Original file line number Diff line number Diff line change
    @@ -34,7 +34,7 @@ Answer: No, but you don't need it, since [GFM allows embedding HTML inside Markd
    ```markdown
    #### Example

    <details>
    <details open>
    <summary>Shopping list</summary>

    * Vegetables
  3. scmx revised this gist Dec 6, 2021. 1 changed file with 1 addition and 5 deletions.
    6 changes: 1 addition & 5 deletions using-details-summary-github.md
    Original file line number Diff line number Diff line change
    @@ -48,11 +48,7 @@ Answer: No, but you don't need it, since [GFM allows embedding HTML inside Markd

    ### More about details/summary

    How about browser support? https://caniuse.com/#feat=details

    > IE and Edge currently don't support it. But those users will just see it expanded all the time
    Here's a polyfill https://github.com/rstacruz/details-polyfill
    Browser support is good https://caniuse.com/#feat=details It falls back to being expanded all the time.
    https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details

    Similar gist https://gist.github.com/ericclemmons/b146fe5da72ca1f706b2ef72a20ac39d
  4. scmx revised this gist Oct 10, 2020. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions using-details-summary-github.md
    Original file line number Diff line number Diff line change
    @@ -44,8 +44,7 @@ Answer: No, but you don't need it, since [GFM allows embedding HTML inside Markd
    </details>
    ```

    *Remember to put a blank line after the `<summary>` start tag and before
    the `</summary>` end tag, otherwise the markdown inside will not work.*
    *Remember that blank lines are needed before/after a section of markdown that is within an html tag, otherwise the markdown won't work*

    ### More about details/summary

  5. scmx revised this gist Sep 27, 2018. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion using-details-summary-github.md
    Original file line number Diff line number Diff line change
    @@ -54,4 +54,6 @@ How about browser support? https://caniuse.com/#feat=details
    > IE and Edge currently don't support it. But those users will just see it expanded all the time
    Here's a polyfill https://github.com/rstacruz/details-polyfill
    https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details
    https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details

    Similar gist https://gist.github.com/ericclemmons/b146fe5da72ca1f706b2ef72a20ac39d
  6. scmx revised this gist Sep 27, 2018. No changes.
  7. scmx revised this gist Sep 27, 2018. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions using-details-summary-github.md
    Original file line number Diff line number Diff line change
    @@ -44,8 +44,8 @@ Answer: No, but you don't need it, since [GFM allows embedding HTML inside Markd
    </details>
    ```

    Remember to put a blank line after the `<summary>` start tag and before
    the `</summary>` end tag, otherwise the markdown inside will not work.
    *Remember to put a blank line after the `<summary>` start tag and before
    the `</summary>` end tag, otherwise the markdown inside will not work.*

    ### More about details/summary

  8. scmx revised this gist Sep 27, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion using-details-summary-github.md
    Original file line number Diff line number Diff line change
    @@ -16,7 +16,7 @@
    ```

    **Is there a special GFM (GitHub Flavoured Markdown) syntax for using `<details>` `<summary>` on GitHub?**
    Answer: No, but you don't need it, since GFM [allows embedding HTML inside Markdown](https://github.github.com/gfm/#html-block).
    Answer: No, but you don't need it, since [GFM allows embedding HTML inside Markdown](https://github.github.com/gfm/#html-block).

    #### Example

  9. scmx revised this gist Sep 27, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion using-details-summary-github.md
    Original file line number Diff line number Diff line change
    @@ -16,7 +16,7 @@
    ```

    **Is there a special GFM (GitHub Flavoured Markdown) syntax for using `<details>` `<summary>` on GitHub?**
    Answer: No, but you don't need it, since GFM allows embedding HTML inside Markdown.
    Answer: No, but you don't need it, since GFM [allows embedding HTML inside Markdown](https://github.github.com/gfm/#html-block).

    #### Example

  10. scmx revised this gist Sep 27, 2018. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions using-details-summary-github.md
    Original file line number Diff line number Diff line change
    @@ -2,9 +2,9 @@

    **Firstly, what is `<details>` `<summary>`?**

    > The HTML Details Element (<details>) creates a disclosure widget in which
    > The HTML Details Element (`<details>`) creates a disclosure widget in which
    > information is visible only when the widget is toggled into an "open" state.
    > A summary or label can be provided using the <summary> element.
    > A summary or label can be provided using the `<summary>` element.
    > https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details.
    ### Example
  11. scmx revised this gist Sep 27, 2018. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions using-details-summary-github.md
    Original file line number Diff line number Diff line change
    @@ -27,7 +27,7 @@ Answer: No, but you don't need it, since GFM allows embedding HTML inside Markdo
    * Fruits
    * Fish

    </summary>
    </details>

    #### Code

    @@ -41,7 +41,7 @@ Answer: No, but you don't need it, since GFM allows embedding HTML inside Markdo
    * Fruits
    * Fish

    </summary>
    </details>
    ```

    Remember to put a blank line after the `<summary>` start tag and before
  12. scmx revised this gist Sep 27, 2018. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions using-details-summary-github.md
    Original file line number Diff line number Diff line change
    @@ -9,10 +9,10 @@
    ### Example

    <details><summary>Toggle me!</summary>Peek a boo!</detail>
    <details><summary>Toggle me!</summary>Peek a boo!</details>

    ```html
    <details><summary>Toggle me!</summary>Peek a boo!</detail>
    <details><summary>Toggle me!</summary>Peek a boo!</details>
    ```

    **Is there a special GFM (GitHub Flavoured Markdown) syntax for using `<details>` `<summary>` on GitHub?**
  13. scmx created this gist Sep 27, 2018.
    57 changes: 57 additions & 0 deletions using-details-summary-github.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,57 @@
    # How to use `<details>` `<summary>` expandable content on GitHub with Markdown

    **Firstly, what is `<details>` `<summary>`?**

    > The HTML Details Element (<details>) creates a disclosure widget in which
    > information is visible only when the widget is toggled into an "open" state.
    > A summary or label can be provided using the <summary> element.
    > https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details.
    ### Example

    <details><summary>Toggle me!</summary>Peek a boo!</detail>

    ```html
    <details><summary>Toggle me!</summary>Peek a boo!</detail>
    ```

    **Is there a special GFM (GitHub Flavoured Markdown) syntax for using `<details>` `<summary>` on GitHub?**
    Answer: No, but you don't need it, since GFM allows embedding HTML inside Markdown.

    #### Example

    <details>
    <summary>Shopping list</summary>

    * Vegetables
    * Fruits
    * Fish

    </summary>

    #### Code

    ```markdown
    #### Example

    <details>
    <summary>Shopping list</summary>

    * Vegetables
    * Fruits
    * Fish

    </summary>
    ```

    Remember to put a blank line after the `<summary>` start tag and before
    the `</summary>` end tag, otherwise the markdown inside will not work.

    ### More about details/summary

    How about browser support? https://caniuse.com/#feat=details

    > IE and Edge currently don't support it. But those users will just see it expanded all the time
    Here's a polyfill https://github.com/rstacruz/details-polyfill
    https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details