A Quarto extension for creating collapsible sections using <details> and <summary> HTML elements without writing raw HTML.
To install the details Quarto extension, follow these steps:
- Open your terminal.
- Execute the following command:
quarto add coatless-quarto/detailsThis command will download and install the Quarto extension under the _extensions subdirectory of your Quarto project. If you are using version control, ensure that you include this directory in your repository.
Use the .details class and specify the summary text with the summary attribute:
::: {.details summary="Click to see more"}
This content will be collapsible.
You can include **any** Markdown content here.
:::Use any heading level as the summary text. The heading will be automatically extracted:
::: {.details}
## Click to expand
This is the collapsible content that appears after the heading.
You can use any heading level: `##`, `###`, `####`, etc.
:::For multi-line or complex summaries, use a nested .summary div:
::: {.details}
::: {.summary}
**Important:** Click to expand
:::
This is the collapsible content.
- Item 1
- Item 2
:::If multiple summary methods are used, the priority is:
- Attribute (
summary="text") - highest priority - Summary div (
::: {.summary}) - First heading (
##,###, etc.) - Default ("Click to expand")
AGPL (>= 3)