- name
- docs-syntax-help
- version
- 1.1.1
- description
- Provide Elastic Docs syntax guidance, troubleshoot markup issues, and help write directives correctly. Use when writing or editing documentation that uses MyST Markdown with Elastic extensions, or when troubleshooting build errors related to syntax.
- argument-hint
- <question-or-directive>
- context
- fork
- allowed-tools
- Read, Grep, Glob, Edit, WebFetch
- sources
- ["https://www.elastic.co/docs/contribute-docs/syntax-quick-reference","https://docs-v3-preview.elastic.dev/elastic/docs-builder/tree/main/syntax"]
<!-- Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
or more contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright
ownership. Elasticsearch B.V. licenses this file to you under
the Apache License, Version 2.0 (the "License"); you may
not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License. -->
You are an Elastic Docs syntax expert. Your job is to help users write correct MyST Markdown with Elastic-specific extensions, troubleshoot syntax errors, and fix malformed directives.
## Directive syntax fundamentals
Directives use colon-fenced blocks with the directive name in curly braces:
```
:::{directive-name} [argument]
:option: value
Content here
:::
```
- **Opening**: Three or more colons, directive name in `{}`
- **Argument**: Optional, on the same line after the name
- **Options**: One per line, colon-prefixed (`:option: value`)
- **Content**: Markdown-processed body
- **Closing**: Same number of colons as opening
### Nesting directives
Outer directives need MORE colons than inner ones. Add one colon per nesting level:
```
::::{tab-set}
:::{tab-item} First
Content
:::
:::{tab-item} Second
Content
:::
::::
```
Three levels deep:
```
::::::{stepper}
:::::{step} Title
::::{tab-set}
:::{tab-item} Option A
Content
:::
::::
:::::
::::::
```
### Literal blocks inside directives
Code blocks use **backtick fences** (not colons) to prevent Markdown processing:
````
:::{note}
```yaml
key: value
```
:::
````
## Admonitions
Four standard types plus custom:
```
:::{note}
Supplemental information. No serious repercussions if ignored.
:::
:::{tip}
Advice to help users work more efficiently.
:::
:::{important}
Ignoring this could impact performance or stability.
:::
:::{warning}
Users could permanently lose data or leak sensitive information.
:::
:::{admonition} Custom title
Plain callout with a custom title and no severity styling.
:::
```
**Rules**: Do not stack admonitions. Do not place code blocks inside admonitions (use dropdowns or tabs instead if code is long).
## Headings
```
# Page title (h1 — exactly one per page, must be first)
## Section (h2)
### Subsection (h3)
#### Sub-subsection (h4)
```
Custom anchors: `#### My heading [custom-anchor-id]`
Default anchors auto-generate as lowercase, hyphenated, alphanumeric (diacritics removed).
## Links
**In-repo page links**: Default to auto-generated link text (`[](page.md)`). The published label is the target page title.
```
[](../path/to/page.md)
[](/absolute/path/to/page.md)
```
Custom link text is allowed when it contextualizes the link. Do not write custom text that restates the page title.
```
You might want to set up [rules](create-manage-rules.md).
```
Anti-pattern: `[Create and manage {{kib}} alerting rules](create-manage-rules.md)` when that string is the page title. Write `[](create-manage-rules.md)` instead.
**Anchors**: Do not use auto-generated link text. Write explicit link text for in-repo section links and same-page jumps.
```
[Link text](/absolute/path/to/page.md#anchor)
[Jump](#section-anchor)
```
**Cross-repository**: `[Text](kibana://path/to/page.md)` — link text is **mandatory**; omitting it causes the link to fail.
**External**: `[Text](https://example.com)` — bare `https://` URLs (not `http://`) are automatically converted to clickable links that open in a new tab. Autolinks are not rendered inside code blocks or inline code. Bare URL autolinks pointing to `elastic.co/docs` trigger a build hint to use a cross-repository or relative link instead.
**Reference-style**:
```
[link text][ref-id]
[ref-id]: https://example.com
```
## Code blocks
````
```yaml
key: value
```
````
### Explicit callouts
Add `<N>` markers at line ends, followed by a matching numbered list:
````
```yaml
host: "0.0.0.0" <1>
port: 9200 <2>
```
1. Bind address
2. Port number
````
The list item count must match the callout count exactly.
### Automatic callouts
Comments on code lines become callouts automatically:
````
```csharp
var key = new ApiKey("<KEY>"); // Set up the API key
```
````
Disable callout processing: ````callouts=false`
**Rule**: Do not mix explicit and automatic callouts in the same code block — use only one type per block.
### Console code blocks
Use `console` as the language. First line renders as a dev console command; rest as JSON.
### Substitutions in code
Enable with `subs=true`:
````
```bash subs=true
wget elasticsearch-{{version}}-linux.tar.gz
```
````
## Tabs
```
::::{tab-set}
:::{tab-item} Label 1
Content for tab 1
:::
:::{tab-item} Label 2
Content for tab 2
:::
::::
```
### Synced tabs
```
::::{tab-set}
:group: languages
:::{tab-item} Java
:sync: java
Java content
:::
:::{tab-item} Python
:sync: python
Python content
:::
::::
```
Tabs with matching `group` and `sync` values synchronize selection across tab sets on the same page.
**Rules**: Do not nest tabs. Do not split procedures across tabs. Do not use more than 6 tabs. Do not use tabs in dropdowns.
## Applies switch
Creates tabbed content where each tab displays an `applies_to` badge instead of a text title. Use when content varies by deployment type or version. All applies switches on a page automatically sync together.
```
::::{applies-switch}
:::{applies-item} stack: ga 9.0+
Content for Stack
:::
:::{applies-item} serverless: ga
Content for Serverless
:::
::::
```
### Multiple applies_to definitions in one item
Use YAML object notation with curly braces `{}` to specify multiple `applies_to` definitions in a single `applies-item`:
```
::::{applies-switch}
:::{applies-item} { ece: ga 4.0+, ech: ga }
Content for ECE and ECH
:::
:::{applies-item} serverless: ga
Content for Serverless
:::
::::
```
**Automatic syncing**: When a user selects an `applies_to` definition in one switch, all other applies-switch instances on the same page update to the same selection. The format of the definition doesn't matter for sync matching — `stack: ga 9.1+`, `{ "stack": "ga 9.1+" }`, and `{ stack: "ga 9.1+" }` all identify the same content.
**When to use**: Use `applies-switch` instead of generic `tab-set` when content differs by deployment type or version and you want to show `applies_to` badges as tab titles.
## Stepper
Sequential steps for tutorials:
```
:::::{stepper}
::::{step} Step title
Step content here.
::::
::::{step} Another step
:anchor: custom-id
More content.
::::
:::::
```
Steps auto-generate anchors and appear in the page ToC. Use `:anchor:` to override. Steps nested inside other directives (tabs, dropdowns) are excluded from the ToC.
## Dropdowns
```
:::{dropdown} Title
Collapsed content.
:::
:::{dropdown} Open by default
:open:
Expanded content.
:::
```
## Images
**Inline**: ``
**Directive** (with options):
```
:::{image} /path/to/image.png
:alt: Description
:width: 400px
:::
```
**Screenshot** (adds border): `:screenshot:` option.
**Sizing** (inline): `` or ``
**Carousel**:
```
::::{carousel}
:id: my-carousel
:max-height: small
:::{image} img1.png
:alt: First
:::
:::{image} img2.png
:alt: Second
:::
::::
```
**Constraint**: Images must live within the folder containing the `toc.yml` or `docset.yml` that references the page.
## Tables
```
| Header 1 | Header 2 |
| -------- | -------- |
| Cell | Cell |
```
Headerless table (empty first header row). Tables are responsive by default (horizontal scroll). Block-level elements cannot be placed inside table cells.
## Lists
Unordered: `-`, `*`, or `+`. Ordered: `1.`, `2.`, etc.
Indent **four spaces** to nest or include content (paragraphs, code blocks, images, admonitions) within list items.
## Definition lists
```
Term
: Definition text indented with colon + three spaces.
Second paragraph of the definition (indented to match).
```
Supports nesting by indenting child definitions under parent definitions.
## Buttons
```
:::{button}
[Button text](/path)
:::
:::{button}
:type: secondary
:align: center
[Secondary](/path)
:::
```
Group buttons:
```
::::{button-group}
:::{button}
[Primary](/path1)
:::
:::{button}
:type: secondary
[Secondary](/path2)
:::
::::
```
## Footnotes
Reference: `text[^fn-id]`. Definition: `[^fn-id]: Footnote content.`
Named identifiers recommended (`[^my-note]`). Footnotes auto-number in order of first reference and render at page bottom. Definitions must be at document level (not inside directives).
## Icons
Syntax: `` {icon}`icon-name` ``
Works in headings, lists, tables, and inline. Over 500 icons available (e.g., `check`, `cross`, `gear`, `user`, `logo_elastic`).
## Keyboard markup
Syntax: `` {kbd}`key` ``
Combinations: `` {kbd}`cmd+shift+p` ``
Platform alternatives: `` {kbd}`ctrl|cmd+c` ``
Special keys: `shift`, `ctrl`, `alt`, `option`, `cmd`, `win`, `enter`, `esc`, `tab`, `space`, `f1`–`f12`, `plus`, `pipe`.
## Inline formatting
| Syntax | Result |
|--------|--------|
| `**bold**` | Bold |
| `_italic_` | Italic |
| `` `code` `` | Monospace |
| `~~strike~~` | Strikethrough |
| `H~2~O` | Subscript |
| `4^th^` | Superscript |
## Comments
Auf GitHub ansehen