Skip to content

Commit eb0bf20

Browse files
authored
[docs] Simplify syntax landing page, factor our directives information into standalone page (#2054)
1 parent a6ed98a commit eb0bf20

File tree

4 files changed

+98
-86
lines changed

4 files changed

+98
-86
lines changed

docs/_docset.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ toc:
9393
- file: conditionals.md
9494
- file: csv-include.md
9595
- hidden: diagrams.md
96+
- file: directives.md
9697
- file: dropdowns.md
9798
- file: definition-lists.md
9899
- file: example_blocks.md

docs/syntax/applies.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ All documentation pages must include an `applies_to` tag in the YAML frontmatter
5252

5353
A header can be followed by an `{applies_to}` directive which contextualizes the applicability of the section further.
5454

55-
Section-level `{applies_to}` directives require triple backticks because their content is literal. Refer to [](index.md#literal-directives) for more information.
55+
Section-level `{applies_to}` directives require triple backticks because their content is literal. Refer to [](directives.md#exception-literal-blocks) for more information.
5656

5757
````markdown
5858
```{applies_to}

docs/syntax/directives.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Directives
2+
3+
Directives extend Markdown with additional features:
4+
5+
```markdown
6+
:::{note}
7+
This is a callout box that stands out from regular text.
8+
:::
9+
```
10+
11+
How directive syntax works:
12+
- `:::` opens and closes the directive block
13+
- `{note}` is the directive type (always in curly braces)
14+
- Content inside is regular Markdown
15+
16+
## Adding options
17+
18+
```markdown
19+
:::{image} screenshot.png
20+
:alt: Dashboard overview <1>
21+
:width: 600px
22+
:::
23+
```
24+
25+
1. Options start with `:` and appear after the opening line.
26+
27+
## Adding arguments
28+
29+
```markdown
30+
:::{include} shared-content.md
31+
:::
32+
```
33+
34+
The argument comes right after the directive name.
35+
36+
## Nesting directives
37+
38+
To nest directives, add more colons to the outer directive:
39+
40+
```markdown
41+
::::{note}
42+
Outer content
43+
44+
:::{hint}
45+
Inner content
46+
:::
47+
48+
More outer content
49+
::::
50+
```
51+
52+
Use four colons (`::::`) for the outer directive and three (`:::`) for the inner one. Need to nest deeper? Keep adding colons.
53+
54+
## Exception: Literal blocks
55+
56+
Code blocks and [`applies_to` blocks](applies.md) use backticks instead of colons to prevent content from being processed as Markdown:
57+
58+
````markdown
59+
```js
60+
const x = 1;
61+
```
62+
````
63+
64+
## Available directives
65+
66+
The following directives are available:
67+
68+
- [Admonitions](admonitions.md) - Callouts and warnings
69+
- [Code blocks](code.md) - Syntax-highlighted code
70+
- [CSV include](csv-include.md) - Render CSV files as tables
71+
- [Diagrams](diagrams.md) - Visual diagrams and charts
72+
- [Dropdowns](dropdowns.md) - Collapsible content
73+
- [Images](images.md) - Enhanced image handling
74+
- [Include](file_inclusion.md) - Include content from other files
75+
- [Settings](automated_settings.md) - Configuration blocks
76+
- [Stepper](stepper.md) - Step-by-step content
77+
- [Tabs](tabs.md) - Tabbed content organization
78+
- [Tables](tables.md) - Data tables
79+
- [Version blocks](version-variables.md) - API version information

docs/syntax/index.md

Lines changed: 17 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,97 +1,29 @@
11
# Syntax guide
22

3-
Elastic Docs V3 uses [Markdown](https://commonmark.org) as its main content authoring format.
3+
Learn about the custom Markdown syntax used in Elastic documentation.
44

5-
:::{admonition} New to Elastic Docs V3?
6-
* Learn [Markdown](https://commonmark.org/help/) in 10 minutes
7-
* Review the V3 [](quick-ref.md)
8-
:::
5+
## Quick reference
96

10-
V3 fully supports [CommonMark](https://commonmark.org/), a strongly defined, standard-compliant Markdown specification. In many cases, plain Markdown syntax will be sufficient when authoring Elastic content. On top of this functionality, there are two main syntax extension points:
7+
Refer to the [quick reference](quick-ref.md) for a condensed syntax cheat sheet.
118

12-
* [Directives](#directives)
13-
* [GitHub-flavored markdown](#github-flavored-markdown)
9+
## How it works
1410

15-
## Available directives
11+
Elastic Docs V3 uses a custom implementation of [MyST](https://mystmd.org/) (Markedly Structured Text), which extends standard Markdown with directive syntax.
1612

17-
The following directives are available in Elastic Docs V3:
13+
If you know [Markdown](https://commonmark.org), you already know most of what you need. If not, the CommonMark project offers a [10-minute tutorial](https://commonmark.org/help/).
1814

19-
* [Admonitions](admonitions.md) - Callouts and warnings
20-
* [Code blocks](code.md) - Syntax-highlighted code
21-
* [CSV include](csv-include.md) - Render CSV files as tables
22-
* [Diagrams](diagrams.md) - Visual diagrams and charts
23-
* [Dropdowns](dropdowns.md) - Collapsible content
24-
* [Images](images.md) - Enhanced image handling
25-
* [Include](file_inclusion.md) - Include content from other files
26-
* [Settings](automated_settings.md) - Configuration blocks
27-
* [Stepper](stepper.md) - Step-by-step content
28-
* [Tabs](tabs.md) - Tabbed content organization
29-
* [Tables](tables.md) - Data tables
30-
* [Version blocks](version-variables.md) - API version information
15+
When you need more than basic Markdown, you can use [directives](directives.md) to add features like callouts, tabs, and diagrams.
3116

32-
## Directives
17+
## GitHub Flavored Markdown support
3318

34-
Directives extend CommonMark functionality. Directives have the following syntax:
19+
V3 supports some GitHub Flavored Markdown extensions:
3520

36-
```markdown
37-
:::{EXTENSION} ARGUMENTS
38-
:OPTION: VALUE
21+
**Supported:**
22+
- Tables (basic pipe syntax)
23+
- Strikethrough with `~~text~~` (renders as ~~text~~)
3924

40-
Nested content that will be parsed as markdown
41-
:::
42-
```
43-
44-
- `EXTENSION` is the name of the directive. Names are always wrapped in brackets `{ }`. For example: [`{note}`](admonitions.md#note).
45-
- `ARGUMENT` an optional main argument. For example: [`:::{include} _snippets/include.md :::`](file_inclusion.md)
46-
- `:OPTION: VALUE` is used to further customize a given directive.
47-
48-
Defining directives with `:::` allows the nested markdown syntax to be highlighted properly by editors and web viewers.
49-
50-
51-
52-
### Nesting Directives
53-
54-
Increase the number of leading semicolons to include nested directives.
55-
56-
In the following example, a `{note}` wraps a `{hint}`:
57-
58-
```markdown
59-
::::{note} My note
60-
:::{hint} My hint
61-
Content displayed in the hint admonition
62-
:::
63-
Content displayed in the note admonition
64-
::::
65-
```
66-
67-
## Literal directives
68-
69-
All directive are indicated with semicolons except literal blocks. For these you need to use triple backticks.
70-
71-
* [Code blocks](code.md)
72-
* [{applies-to} blocks](applies.md)
73-
74-
Since their contents **should not** be parsed as markdown they use backticks. This also ensures maximum interopability with existing markdown editors and previews.
75-
76-
Many Markdown editors support syntax highlighting for embedded code blocks. For compatibility with this feature, use triple backticks instead of triple colons for content that needs to be displayed literally:
77-
78-
````markdown
79-
```js
80-
const x = 1;
81-
```
82-
````
83-
84-
## GitHub Flavored Markdown
85-
86-
We support _some_ [GitHub Flavored Markdown (GFM) extensions](https://github.github.com/gfm/).
87-
88-
### Supported
89-
90-
* [](tables.md#basic-table)
91-
* Strikethrough: ~~as seen here~~
92-
93-
### Not supported
94-
95-
* Task lists
96-
* Auto links (http://www.elastic.co)
97-
* Using a subset of HTML
25+
**Not supported:**
26+
- Task lists
27+
- Automatic URL linking: https://www.elastic.co
28+
- Links must use standard Markdown syntax: [Elastic](https://www.elastic.co)
29+
- Using a subset of HTML

0 commit comments

Comments
 (0)