모듈 및 패키지 문서

모듈 및 패키지 문서 (Module and package documentation)

프로젝트 전체나 특정 패키지에 대한 설명을 문서에 직접 넣고 싶을 때가 있어요. Dokka에서는 이런 설명을 별도의 Markdown 파일로 제공할 수 있는데, 이번에 그 방법을 살펴볼게요.

출처: Module documentation

본문

서브프로젝트 전체에 대한 문서와 그 안에 있는 패키지들에 대한 문서는 각각 별도의 Markdown 파일로 제공할 수 있어요.

파일 형식

Markdown 파일 안에서, 서브프로젝트 전체 문서와 개별 패키지 문서는 해당하는 1단계 제목(first-level heading)으로 구분돼요. 제목의 텍스트는 서브프로젝트일 때 Module <module name>, 패키지일 때 Package <package qualified name> 형식이어야 해요.

파일에 서브프로젝트 문서와 패키지 문서가 반드시 둘 다 들어 있어야 하는 건 아니에요. 패키지 문서만, 또는 서브프로젝트 문서만 담은 파일도 가능해요. 심지어 서브프로젝트나 패키지마다 Markdown 파일을 하나씩 만들 수도 있어요.

Markdown 문법을 사용해서 다음을 추가할 수 있어요:

  • 6단계까지의 제목
  • 굵게나 기울임으로 강조
  • 링크
  • 인라인 코드
  • 코드 블록
  • 인용문(blockquote)

서브프로젝트와 패키지 문서를 모두 담은 예시 파일을 하나 보여드릴게요:


# Module kotlin-demo

This content appears under your subproject name.

# Package org.jetbrains.kotlin.demo

This content appears under your package name in the packages list.
It also appears under the first-level heading on your package's page.

## Level 2 heading for package org.jetbrains.kotlin.demo

Content after this heading is also part of documentation for `org.jetbrains.kotlin.demo`

# Package org.jetbrains.kotlin.demo2

This content appears under your package name in the packages list.
It also appears under the first-level heading on your package's page.

## Level 2 heading for package org.jetbrains.kotlin.demo2

Content after this heading is also part of documentation for `org.jetbrains.kotlin.demo2`

Gradle 예제 프로젝트를 직접 돌려보고 싶다면 Dokka gradle example을 확인해 보세요.

파일을 Dokka에 전달하기

이 파일들을 Dokka에 전달하려면 Gradle, Maven, CLI에 해당하는 includes 옵션을 사용해야 해요:

더 알아보기

  • Dokka 플러그인을 적용하고 확장하는 법은 Dokka plugins에서 배워요.