Skip to content

模組文件

整個模組以及該模組中套件的文件,可以作為獨立的 Markdown 檔案提供。

檔案格式

在 Markdown 檔案中,整個模組及個別套件的文件由對應的一級標題引入。模組的標題文字必須Module <module name>,而套件的標題文字則必須Package <package qualified name>

該檔案不必同時包含模組與套件的文件。您可以只包含套件或模組文件的檔案。您甚至可以為每個模組或套件建立一個 Markdown 檔案。

使用 Markdown 語法,您可以新增:

  • 高達 6 級的標題
  • 以粗體或斜體格式進行強調
  • 連結
  • 行內程式碼
  • 程式碼區塊
  • 引言區塊

以下是一個包含模組與套件文件的範例檔案:

text
# Module kotlin-demo

This content appears under your module 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 範例

將檔案傳遞給 Dokka

若要將這些檔案傳遞給 Dokka,您需要使用 Gradle、Maven 或 CLI 的對應 includes 選項:

Source set configuration 中使用 includes 選項。

General configuration 中使用 includes 選項。

如果您使用命令列配置,請在 Source set options 中使用 includes 選項。

如果您使用 JSON 配置,請在 General configuration 中使用 includes 選項。