Skip to content

Document a component

Give a component version a documentation site — an introduction, how to set it up, the meaning of every setting, worked examples — next to its short description. Documentation is optional: most components only need the description, and nothing changes for them.

Prerequisites

  • A component .kts of any kind (data type, method, workflow type, material).
  • SimKit CLI installed (see installation).

Write the pages

Documentation is a tree of Markdown pages. Keep them as files next to the component definition, in a docs/ folder, and reference images and other pages with ordinary relative paths — exactly as you would in any Markdown project, so the files preview correctly in your editor and in GitLab:

flexible-valve/
├── flexible_valve.workflow-type.kts
└── docs/
    ├── introduction.md
    ├── creating-a-simulation.md
    ├── settings/
    │   ├── index.md
    │   ├── materials.md
    │   └── boundary-conditions.md
    └── images/
        └── valve-overview.png
The flexible valve workflow computes …

![Valve overview](images/valve-overview.png)

Start with [creating a simulation](creating-a-simulation.md), then look
up the [materials](settings/materials.md#density) you need.

Pages are rendered under their title, so do not start a page with a top-level heading repeating it; use ## and below for the sections within a page. Headings get anchors, so other-page.md#section links land on the section.

Declare the pages

In the metadata { } block, add a documentation { } block. Every page has an identifier (kebab-case, unique within the documentation, used in links and URLs), a title and its content:

metadata {
    reference = "simscale.valves:flexible-valve:1.0.0"
    name = "Flexible valve"
    description = "Flow through a valve with a deforming membrane."

    documentation {
        page("introduction") {
            title = "Introduction"
            contentFile = "docs/introduction.md"
        }
        page("creating-a-simulation") {
            title = "Creating a simulation"
            contentFile = "docs/creating-a-simulation.md"
        }
        page("settings") {
            title = "Settings"
            contentFile = "docs/settings/index.md"
            page("materials") {
                title = "Materials"
                contentFile = "docs/settings/materials.md"
            }
            page("boundary-conditions") {
                title = "Boundary conditions"
                contentFile = "docs/settings/boundary-conditions.md"
            }
        }
    }
}

The page tree is the table of contents: top-level pages are the chapters, nested pages their sections. Short content can also be given inline with content = "…" instead of contentFile.

Other languages

Titles and content take a language the same way names and descriptions do; a language that has no content for a page falls back to the default:

page("introduction") {
    title = "Introduction"
    title(Locale.GERMAN, "Einführung")
    contentFile = "docs/introduction.md"
    contentFile(Locale.GERMAN, "docs/de/einfuehrung.md")
}

Build

simkit component build resolves the pages:

  • every relative image reference is checked (the file must exist and be a PNG, JPEG, GIF, WebP or SVG) and the image is included in the component under its path relative to the component directory;
  • every relative link to another page's Markdown file is rewritten into a link to that page by identifier (page:<id>, keeping any #section); a link to a file that is not a page fails the build;
  • external links (https://…) stay as written.

A problem fails the build with the page identifier and the reference in the message, for example Documentation page 'introduction' embeds image 'images/valve.png', which does not exist.

Check the result

After registering, the component version page in the SimKit web UI has a Documentation section with the table of contents, and Open documentation shows the pages as a site with the table of contents on the side and a language switch. From the CLI:

simkit component documentation simscale.valves:flexible-valve:1.0.0
simkit component documentation simscale.valves:flexible-valve:1.0.0 --page materials
simkit component documentation simscale.valves:flexible-valve:1.0.0 --page introduction --language de

The platform reads the same pages through the component registry API (GET /component-versions/{reference}/documentation, one page at /documentation/pages/{pageId}, images at /documentation/image?name=…), which is what user-facing applications render the documentation from.

Example

The e2e test components document two components this way: the mock-mesher method (e2e/components/methods/mock-mesher/docs/, with a German overview) and the test-native workflow type (e2e/components/workflow-types/test-native-workflow/docs/, in the shape of the public analysis-type documentation: introduction, creating a run, a settings chapter with one page per settings group, example projects).