Skip to main content

Creating Markdown Pages

This is a collection of tutorials for creating markdown pages in Konfig.

Creating a Page

To add a page, simply create a new markdown file in your repository. For example, docs/new-page.md.

Then edit your konfig.yaml file's documentation.sidebar.sections to include the new page.

konfig.yaml

_12
portal:
_12
title: Acme
_12
primaryColor: '#9fc1be'
_12
socials:
_12
website: https://acme.com
_12
documentation:
_12
sidebar:
_12
sections:
_12
- label: Guides
_12
links:
_12
- id: existing-page
_12
path: docs/existing-page.md

Add to the list of pages under your desired section.

konfig.yaml

_14
portal:
_14
title: Acme
_14
primaryColor: '#9fc1be'
_14
socials:
_14
website: https://acme.com
_14
documentation:
_14
sidebar:
_14
sections:
_14
- label: Guides
_14
links:
_14
- id: existing-page
_14
path: docs/existing-page.md
_14
- id: new-page
_14
path: docs/new-page.md

The id property is used to uniquely identify the page. It is also used to determine the URL of the page. For example, if the id is new-page then the URL will have a subpath of /new-page. This is important so that the URL of the page is stable and does not change if the path of the markdown file changes.

konfig.yaml

_14
portal:
_14
title: Acme
_14
primaryColor: '#9fc1be'
_14
socials:
_14
website: https://acme.com
_14
documentation:
_14
sidebar:
_14
sections:
_14
- label: Guides
_14
links:
_14
- id: existing-page
_14
path: docs/existing-page.md
_14
- id: new-page
_14
path: docs/new-page.md

The path property is the path to the markdown file relative to the repository root (e.g. where konfig.yaml lives).

konfig.yaml

_14
portal:
_14
title: Acme
_14
primaryColor: '#9fc1be'
_14
socials:
_14
website: https://acme.com
_14
documentation:
_14
sidebar:
_14
sections:
_14
- label: Guides
_14
links:
_14
- id: existing-page
_14
path: docs/existing-page.md
_14
- id: new-page
_14
path: docs/new-page.md

Then edit your konfig.yaml file's documentation.sidebar.sections to include the new page.

Add to the list of pages under your desired section.

The id property is used to uniquely identify the page. It is also used to determine the URL of the page. For example, if the id is new-page then the URL will have a subpath of /new-page. This is important so that the URL of the page is stable and does not change if the path of the markdown file changes.

The path property is the path to the markdown file relative to the repository root (e.g. where konfig.yaml lives).

konfig.yaml

_12
portal:
_12
title: Acme
_12
primaryColor: '#9fc1be'
_12
socials:
_12
website: https://acme.com
_12
documentation:
_12
sidebar:
_12
sections:
_12
- label: Guides
_12
links:
_12
- id: existing-page
_12
path: docs/existing-page.md

Commit both new-page.md and the updated konfig.yaml to your repository and the documentation portal will automatically update.

Configuring the link label

The label of the link in the sidebar will be taken directly from the first heading in the markdown file. For example, if the first heading is # New Page then the label will be New Page. This ensures the link labels match the heading of the page.

Markdown title
Example matching link and page title

Creating a Section

To add a section, simply add a new section to your konfig.yaml file's documentation.sidebar.sections list.

konfig.yaml

_12
portal:
_12
title: Acme
_12
primaryColor: '#9fc1be'
_12
socials:
_12
website: https://acme.com
_12
documentation:
_12
sidebar:
_12
sections:
_12
- label: Guides
_12
links:
_12
- id: existing-page
_12
path: docs/existing-page.md

Here is an example adding a "New Section" to the sidebar.

konfig.yaml

_16
portal:
_16
title: Acme
_16
primaryColor: '#9fc1be'
_16
socials:
_16
website: https://acme.com
_16
documentation:
_16
sidebar:
_16
sections:
_16
- label: Guides
_16
links:
_16
- id: existing-page
_16
path: docs/existing-page.md
_16
- label: New Section
_16
links:
_16
- id: new-page
_16
path: docs/new-page.md

The label is used as the section title in the sidebar.

konfig.yaml

_16
portal:
_16
title: Acme
_16
primaryColor: '#9fc1be'
_16
socials:
_16
website: https://acme.com
_16
documentation:
_16
sidebar:
_16
sections:
_16
- label: Guides
_16
links:
_16
- id: existing-page
_16
path: docs/existing-page.md
_16
- label: New Section
_16
links:
_16
- id: new-page
_16
path: docs/new-page.md

The links property is a list of links to pages in the section.

konfig.yaml

_16
portal:
_16
title: Acme
_16
primaryColor: '#9fc1be'
_16
socials:
_16
website: https://acme.com
_16
documentation:
_16
sidebar:
_16
sections:
_16
- label: Guides
_16
links:
_16
- id: existing-page
_16
path: docs/existing-page.md
_16
- label: New Section
_16
links:
_16
- id: new-page
_16
path: docs/new-page.md

The id is used to uniquely identify the page. It is also used to determine the URL of the page. For example, if the id is new-page then the URL will have a subpath of /new-page. This is important so that the URL of the page is stable and does not change if the path of the markdown file changes.

konfig.yaml

_16
portal:
_16
title: Acme
_16
primaryColor: '#9fc1be'
_16
socials:
_16
website: https://acme.com
_16
documentation:
_16
sidebar:
_16
sections:
_16
- label: Guides
_16
links:
_16
- id: existing-page
_16
path: docs/existing-page.md
_16
- label: New Section
_16
links:
_16
- id: new-page
_16
path: docs/new-page.md

The path property is the path to the markdown file relative to the repository root (e.g. where konfig.yaml lives).

konfig.yaml

_16
portal:
_16
title: Acme
_16
primaryColor: '#9fc1be'
_16
socials:
_16
website: https://acme.com
_16
documentation:
_16
sidebar:
_16
sections:
_16
- label: Guides
_16
links:
_16
- id: existing-page
_16
path: docs/existing-page.md
_16
- label: New Section
_16
links:
_16
- id: new-page
_16
path: docs/new-page.md

To add a section, simply add a new section to your konfig.yaml file's documentation.sidebar.sections list.

Here is an example adding a "New Section" to the sidebar.

The label is used as the section title in the sidebar.

The links property is a list of links to pages in the section.

The id is used to uniquely identify the page. It is also used to determine the URL of the page. For example, if the id is new-page then the URL will have a subpath of /new-page. This is important so that the URL of the page is stable and does not change if the path of the markdown file changes.

The path property is the path to the markdown file relative to the repository root (e.g. where konfig.yaml lives).

konfig.yaml

_12
portal:
_12
title: Acme
_12
primaryColor: '#9fc1be'
_12
socials:
_12
website: https://acme.com
_12
documentation:
_12
sidebar:
_12
sections:
_12
- label: Guides
_12
links:
_12
- id: existing-page
_12
path: docs/existing-page.md

Writing Markdown

Konfig supports writing documentation in markdown. All the standard markdown features are supported. For more information on markdown, see this guide.

Adding Videos

You can embed iframes in your markdown to embed videos.

For example, to embed a YouTube video simply copy the embed code from YouTube like so:

doc.md

_10
# Getting Started
_10
_10
<iframe width="560" height="315" src="https://www.youtube.com/embed/wTcNtgA6gHs?si=AL2bgKaSF9nxIuPm" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>

Your documentation will then have the video embedded in it.

video
Screenshot of embedded YouTube video

Adding Images

To add images, simply add them to your repository and reference them in your markdown.

For example if doc.md lives in the same directory as image.png you can reference it with a relative path like so:

doc.md

_10
![Image Alt Text](./image.png)

If you wanted to refer to images in a subfolder, you could do so like this:

doc.md

_10
![Image Alt Text](./images/image.png)

If you wanted to refer to images in a parent folder, you could do so like this:

doc.md

_10
![Image Alt Text](../image.png)

warning

Image paths are not relative to the repository root or konfig.yaml file. They are relative to the markdown file they are referenced in.

Markdown Extensions

Konfig supports a few extensions to markdown to make it easier to write better documentation.

Konfig easily allows you to link to API endpoints.

API Endpoint Links
API Endpoint Link Example

Syntax

To do this, use the :api[OPERATION_ID] directive. For example if I have an operation with an operationId of Authentication_login I can reference it like so:

doc.md

_10
:api[Authentication_login]

Callouts

Konfig supports callouts for grabbing the reader's attention.

Callouts
Callout Examples

Syntax

To use them, simply use the callout directive for the respective callout.

doc.md

_24
_24
:::info{title="Optional Title"}
_24
This is an informational callout
_24
:::
_24
_24
:::info
_24
Without a title
_24
:::
_24
_24
:::note{title="With a title"}
_24
This is an noteworthy callout
_24
:::
_24
_24
:::note
_24
Without a title
_24
:::
_24
_24
:::warn{title="With a title"}
_24
This is an warning callout
_24
:::
_24
_24
:::warn
_24
Without a title
_24
:::

Code Tabs

Konfig supports code tabs for neatly displaying code snippets in multiple languages.

Code Tabs
Code Tabs Example

Syntax

To use them, simply use the code directive and add snippets in adjacent code blocks.

doc.md

_11
:::code
_11
_11
```python
_11
print("Hello, World!")
_11
```
_11
_11
```typescript
_11
console.log("Hello, World!");
_11
```
_11
_11
:::

Gotchas

Do not use ::: in replacement of ```

The following is incorrect ❌:

doc.md

_10
:::python
_10
print("Hello, World!")
_10
:::

Instead use the following ✅:

doc.md

_10
```python
_10
```

Do not use if you only have one code block

Do not use :::code if you only have one code block. Using a single code block like so is correct:

doc.md

_10
```python
_10
print("Hello, World!")
_10
```

While using :::code with a single code block is incorrect:

doc.md

_10
:::code
_10
_10
```python
_10
print("Hello, World!")
_10
```
_10
:::