|
1 |
| -# Guide around Markdown features, formatting, and frontmatter fields |
| 1 | +# Markdown documentation formatting guide |
2 | 2 |
|
3 | 3 | This document gives an overview of the Markdown features and formatting options available for the docs in this repository. It also provides information about the frontmatter fields that can be used to customize the behavior and appearance of the documentation pages.
|
4 | 4 |
|
| 5 | +These documentation pages live in: |
| 6 | + |
| 7 | +* General documentation: https://github.com/prometheus/docs/tree/main/docs |
| 8 | +* Prometheus server documentation: https://github.com/prometheus/prometheus/tree/main/docs |
| 9 | +* Alertmanager documentation: https://github.com/prometheus/alertmanager/tree/main/docs |
| 10 | + |
5 | 11 | ## Markdown features
|
6 | 12 |
|
7 |
| -Generally, we use [GitHub Flavored Markdown](https://github.github.com/gfm/) for formatting and add some custom filters on top: |
| 13 | +Generally, we use [GitHub Flavored Markdown](https://github.github.com/gfm/) for formatting with some custom filters on top: |
8 | 14 |
|
9 |
| -* Paragraphs that start with `TIP:`, `NOTE:`, `CAUTION:`, or `TODO:` are automatically converted to alert boxes with an appropriate icon and color. |
10 |
| -* Code blocks are automatically highlighted using [Shiki](https://shiki.matsu.io/). |
11 |
| -* On configuration pages like https://prometheus.io/docs/prometheus/latest/configuration/configuration/, any inline `<code>` element with a text pattern of `<placeholder>` (e.g. `<string>` or `<scrape_config>`) will be identified as a type definition, and references to those placeholders in code boxes will be linked to them. |
12 |
| -* Links to images and other pages are normalized in various ways to point to the right locations, show external link icons, etc. |
| 15 | +* **Alert boxes:** Paragraphs that start with `TIP:`, `NOTE:`, `CAUTION:`, or `TODO:` are automatically converted to alert boxes with an appropriate icon and color. |
| 16 | +* **Syntax highlighting:** Code blocks are automatically highlighted using [Shiki](https://shiki.matsu.io/). |
| 17 | +* **Config placeholder definition linking:** On configuration pages like https://prometheus.io/docs/prometheus/latest/configuration/configuration/, any inline `<code>` element with a text pattern of `<placeholder>` (e.g. `<string>` or `<scrape_config>`) will be identified as a type definition, and references to those placeholders in code boxes will be linked to them. |
| 18 | +* **Link normalization:** Links to images and other pages are normalized in various ways to point to the right locations, show external link icons, etc. |
13 | 19 |
|
14 |
| -## Heading levels |
| 20 | +## Frontmatter fields |
15 | 21 |
|
16 |
| -For blog posts and documentation pages, please use headings in the following ways: |
| 22 | +The following frontmatter fields are available: |
17 | 23 |
|
18 | 24 | ### For documentation pages
|
19 | 25 |
|
20 |
| -* Start the Markdown content with a single top-level heading (`# Heading`, `<h1>`) that reflects the page title (should usually be the same as the `title` frontmatter field). |
21 |
| -* Use second-level headings (`## Heading`, `<h2>`) for the main sections of the page and use lower-level headings for subsections as appropriate. |
| 26 | +| Field | Description | |
| 27 | +|-------|-------------| |
| 28 | +| `title` | The title of the page. This is displayed as the main heading on the page and as the HTML page title. | |
| 29 | +| `nav_title` | (OPTIONAL) An alternate (usually shorter) title to show in the navigation menu and in the previous/next pagination buttons. If not set, the `title` field is used. | |
| 30 | +| `sort_rank` | The sort order of the page relative to its sibling pages in the same directory. Pages with a lower sort rank will appear first in the navigation menu. Should start at 1 and be incremented by 1 for each page in the same directory. | |
| 31 | +| `nav_icon` | (OPTIONAL) The [Tabler](https://tabler.io/icons) icon to be displayed in the navigation menu for this section. This is only used for the top-level section `index.md` Markdown files and doesn't have any effect when used in actual documentation pages. Any new icons need to be added to the `iconMap` in [`src/app/docs/layout.tsx`](src/app/docs/layout.tsx). | |
| 32 | +| `hide_in_nav` | (OPTIONAL) If set to `true`, the page will not be included in the navigation menu but still be accessible via its URL. | |
22 | 33 |
|
23 | 34 | ### For blog posts
|
24 | 35 |
|
25 |
| -* **DO NOT use any top-level headings (`# Heading`, `<h1>`) in the Markdown content itself.** The final rendered page will include an automatic H1 heading based on the `title` frontmatter field. |
| 36 | +| Field | Description | |
| 37 | +|-------|-------------| |
| 38 | +| `title` | The title of the blog post. This is displayed as the main heading on the page and as the HTML page title. | |
| 39 | +| `author_name` | The name of the author of the blog post. | |
| 40 | +| `created_at` | The date of the blog post in `YYYY-mm-dd` format. | |
| 41 | + |
| 42 | +## Proper usage of heading levels |
| 43 | + |
| 44 | +For both blog posts and documentation pages, please use headings in the following ways: |
| 45 | + |
| 46 | +* **DO NOT use any top-level headings (`# Heading`, `<h1>`) in the Markdown content itself.** The final rendered page will already include an automatic H1 heading based on the `title` frontmatter field. |
26 | 47 | * Use second-level headings (`## Heading`, `<h2>`) for the main sections of the blog post and use lower-level headings for subsections as appropriate.
|
27 | 48 |
|
28 |
| -### Links between pages |
| 49 | +## Links between pages |
29 | 50 |
|
30 | 51 | When linking *between* documentation pages, use the following rules:
|
31 | 52 |
|
32 | 53 | * When linking between docs within the same repository:
|
33 | 54 | * Use either a full repo-rooted path (`/docs/concepts/data_model.md`) or a relative file path (`../guides/utf8.md`) in such a way that the link also works on GitHub.
|
34 | 55 | * Note: Keep the `.md` extension in the link.
|
35 | 56 | * When linking between docs that live in different source repos:
|
36 |
| - * Use absolute site URL paths that start with `/docs/...`, omit the `.md` extension, but end with a slash, e.g. `/docs/concepts/data_model/`. |
37 |
| - |
38 |
| -## Frontmatter fields |
39 |
| - |
40 |
| -The following frontmatter fields are available: |
41 |
| - |
42 |
| -### For local and remote documentation pages |
43 |
| - |
44 |
| -* `title`: The title of the page. This is displayed as the main heading on the page and as the HTML page title. |
45 |
| -* `sort_rank`: The sort order of the page relative to its sibling pages in the same directory. Pages with a lower sort rank will appear first in the navigation menu. Should start at 1 and be incremented by 1 for each page. |
46 |
| -* `nav_title` (OPTIONAL): The title to show in the navigation menu. If not set, the `title` field is used. This can be useful for showing a shorter title in the navigation menu, if necessary. |
47 |
| -* `hide_in_nav` (OPTIONAL): If set to `true`, the page will not be included in the navigation menu but still be accessible via its URL. |
48 |
| -* `nav_icon` (OPTIONAL): The [Tabler](https://tabler.io/icons) icon to be displayed in the navigation menu for this section. This is only used for the top-level section `index.md` Markdown files. Any new icons need to be added to the `iconMap` in [`src/app/docs/layout.tsx`](src/app/docs/layout.tsx). |
49 |
| - |
50 |
| -### For blog posts |
51 |
| - |
52 |
| -* `title`: The title of the blog post. This is displayed as the main heading on the page and as the HTML page title. |
53 |
| -* `author_name`: The name of the author of the blog post. |
54 |
| -* `created_at`: The date of the blog post in `YYYY-mm-dd` format. |
| 57 | + * Use absolute Prometheus website URL paths that start with `/docs/...`, omit the `.md` extension, and end the link with a slash, e.g. `/docs/concepts/data_model/` (links without a trailing slash will still work, but will incur an additional redirect). |
0 commit comments