목차 단락
마크다운 문서는 화면 오른쪽 상단에 목차를 보여줍니다.
하지만 MDX 덕분에 마크다운 문서 내에 바로 목차 단락을 추가하는 기능도 사용할 수 있습니다.
전체 목차#
MDX 문서 내에서 toc 변수를 사용할 수 있습니다. 현재 MDX 문서의 모든 최상위 제목 단락을 포함합니다.
import TOCInline from '@theme/TOCInline';
<TOCInline toc={toc} />;사용자 지정 목차#
toc 속성은 목차 항목의 목록을 가리킵니다.
type TOCItem = { value: string; id: string; children: TOCItem[];};새롭게 목차를 구성하거나 toc 변수로부터 새로운 목차 구성을 가져올 수 있습니다.
import TOCInline from '@theme/TOCInline';
<TOCInline toc={ // Only show 3th and 5th top-level heading [toc[2], toc[4]] }/>;caution
아래에 있는 콘텐츠는 현재 페이지에서 다양한 형태로 아이템 목차를 활용할 수 있다는 것을 보여주기 위한 예제입니다.
Example Section 1#
Lorem ipsum
Example Subsection 1 a#
Lorem ipsum
Example Subsection 1 b#
Lorem ipsum
Example Subsection 1 c#
Lorem ipsum
Example Section 2#
Lorem ipsum
Example Subsection 2 a#
Lorem ipsum
Example Subsection 2 b#
Lorem ipsum
Example Subsection 2 c#
Lorem ipsum
Example Section 3#
Lorem ipsum
Example Subsection 3 a#
Lorem ipsum
Example Subsection 3 b#
Lorem ipsum
Example Subsection 3 c#
Lorem ipsum