217 단어
1 분
Markdown Collapse Panels

Collapse panels keep related optional details in one compact group. Titles and bodies retain inline and block Markdown, while native disclosure semantics make every panel usable without client JavaScript.

Independent panels#

Items open independently by default. Prefix a title with :+ to open that item initially or :- to keep it closed when the group uses expand.

Package requirements

Use Node.js 22 or newer and enable Corepack before installing packages.

Install dependencies

Run the workspace package command from the repository root.

Terminal window
pnpm.cmd install
Validation commands

Check the content pipeline before building the production output.

  • pnpm.cmd check:manifest
  • npx.cmd astro check

Accordion mode#

Add accordion when only one answer should remain open. The browser groups the native disclosures directly, so opening another item closes the previous one without hydration.

What does expand do here?

It opens the first item initially when no item has a :+ marker.

Can a title contain Markdown?

Yes. Titles support inline emphasis and code, while panel bodies support full block Markdown.

What happens on a narrow screen?

Content padding becomes compact, long text wraps, and embedded code keeps its own horizontal scrolling area.

Author syntax#

::: collapse accordion
- :+ First title
First panel content.
- Second title with `code`
Second panel content.
:::

The container must contain exactly one top-level unordered list. Every item needs a title paragraph, a blank line, and body content. Invalid or mixed input remains an ordinary readable Markdown list.

Markdown Collapse Panels
https://blog.kagurayami.top/ko/posts/collapse-panels/
저자
Shirone
게시일
2026-08-28
라이선스
CC BY-NC-SA 4.0

게시글 공유

공유 카드를 생성하거나 링크를 복사하여 공유하세요.

계속 읽기

관련 글

공통 태그와 카테고리를 바탕으로

다른 길로

다른 글에서 일관된 기준으로 선정