Skip to content

Commit ddd64a5

Browse files
Mpdreamzreakaleek
andauthored
Refactor Markdown directives for updated syntax compatibility (#199)
Co-authored-by: Jan Calanog <[email protected]>
1 parent 5b2d6e8 commit ddd64a5

24 files changed

+209
-131
lines changed

docs/source/docset.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ external_hosts:
1717
- palletsprojects.com
1818
- google.com
1919
- checkvist.com
20+
- commonmark.org
2021
exclude:
2122
- '_*.md'
2223
subs:
@@ -64,6 +65,7 @@ toc:
6465
- folder: syntax
6566
children:
6667
- file: index.md
68+
- file: md-extensions.md
6769
- file: admonitions.md
6870
- file: automated_settings.md
6971
- file: code.md
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
This is a snippet included on "{{page_title}}".
22

3-
```{tip}
3+
:::{tip}
44
This is a snippet
5-
```
5+
:::

docs/source/syntax/admonitions.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ This is a warning.
3939
:::
4040
```
4141

42-
```{warning}
42+
:::{warning}
4343
This is a warning.
44-
```
44+
:::
4545

4646
### Tip
4747

@@ -53,9 +53,9 @@ This is a tip.
5353
:::
5454
```
5555

56-
```{tip}
56+
:::{tip}
5757
This is a tip.
58-
```
58+
:::
5959

6060
### Important
6161

@@ -67,15 +67,15 @@ This is an important notice.
6767
:::
6868
```
6969

70-
```{important}
70+
:::{important}
7171
This is an important notice.
72-
```
72+
:::
7373

7474
## Collapsible admonitions
7575

76-
```{tip}
76+
:::{tip}
7777
Also see [dropdowns](./dropdowns.md).
78-
```
78+
:::
7979

8080
Use `:open: <bool>` to make an admonition collapsible.
8181

@@ -89,13 +89,13 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor i
8989
:::
9090
```
9191

92-
```{note}
92+
:::{note}
9393
:open:
9494

9595
Longer content can be collapsed to take less space.
9696

9797
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
98-
```
98+
:::
9999

100100
---
101101

docs/source/syntax/automated_settings.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@ groups:
3232
3333
_Everything below this line is auto-generated._
3434
35-
```{settings} /syntax/kibana-alerting-action-settings.yml
36-
```
35+
:::{settings} /syntax/kibana-alerting-action-settings.yml
36+
:::

docs/source/syntax/code.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ var apiKey = new ApiKey("<API_KEY>"); // Set up the api key
7474
var client = new ElasticsearchClient("<CLOUD_ID>", apiKey);
7575
```
7676

77-
```{note}
77+
:::{note}
7878
the comments have the follow code to be hoisted as a callout.
79-
```
79+
:::
8080

8181
````markdown
8282
```csharp

docs/source/syntax/conditionals.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
title: Conditionals
33
---
44

5-
```{warning}
5+
:::{warning}
66
This feature is not currently supported in Elastic Docs V3.
7-
```
7+
:::

docs/source/syntax/dropdowns.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ Dropdown content
2727
:::
2828
```
2929

30-
```{dropdown} Dropdown Title
30+
:::{dropdown} Dropdown Title
3131
:open:
3232
Dropdown content
33-
```
33+
:::
3434

3535
## Asciidoc syntax
3636

docs/source/syntax/example_blocks.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
title: Example blocks
33
---
44

5-
```{warning}
5+
:::{warning}
66
This feature is not currently supported in Elastic Docs V3.
7-
```
7+
:::

docs/source/syntax/images.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ Images can be referenced from the top-level `_static` dir or a local image dir.
1212

1313
Screenshots are images displayed with a box-shadow.
1414

15-
```{warning}
15+
:::{warning}
1616
This feature is not currently supported in Elastic Docs V3.
17-
```
17+
:::
1818

1919
## Block-level images
2020

@@ -33,10 +33,10 @@ Or, use the `image` directive.
3333
:::
3434
```
3535

36-
```{image} /_static/img/observability.png
36+
:::{image} /_static/img/observability.png
3737
:alt: Elasticsearch
3838
:width: 250px
39-
```
39+
:::
4040

4141
## Inline images
4242

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
---
2+
title: Markdown Syntax Extensions
3+
title_navigation: Markdown Syntax
4+
---
5+
6+
## Syntax
7+
8+
The new documentation fully supports [CommonMark](https://commonmark.org/) Markdown syntax.
9+
10+
On top of this widely accepted feature set we have various extensions points.
11+
12+
## Directives
13+
14+
Directives are our main extension point over markdown and follows the following syntax
15+
16+
17+
```markdown
18+
:::{EXTENSION} ARGUMENTS
19+
:OPTION: VALUE
20+
21+
Nested content that will be parsed as markdown
22+
:::
23+
```
24+
25+
- `EXTENSION` is the name of the directive e.g [`note`](admonitions.md#note)
26+
- `ARGUMENT` some directives take a main argumnt e.g [`:::{include} _snippets/include.md`](file_inclusion.md)
27+
- `OPTION` and `VALUE` can be used to further customize a given directive.
28+
29+
The usage of `:::` allows the nested markdown to be syntax highlighted properly by editors and web viewers.
30+
31+
Our (directives) are always wrapped in brackets `{ }`.
32+
33+
### Nesting Directives
34+
35+
You can increase the leading semicolons to include nested directives. Here the `{note}` wraps a `{hint}`.
36+
37+
```markdown
38+
::::{note} My note
39+
:::{hint} My hint
40+
Content displayed in the hint admonition
41+
:::
42+
Content displayed in the note admonition
43+
::::
44+
```
45+
46+
## Literal directives
47+
48+
For best editor compatability it is recommended to use triple backticks for content that needs to be displayed literally
49+
50+
````markdown
51+
```js
52+
const x = 1;
53+
```
54+
````
55+
56+
Many markdown editors support syntax highlighting for embedded code blocks.
57+
58+
## Github Flavored Markdown
59+
60+
We support some of GitHub flavor markdown extensions these are highlighted in green here: https://github.github.com/gfm/
61+
62+
Supported:
63+
64+
* GFM Tables [](tables.md#github-flavored-markdown-gfm-table)
65+
* Strikethrough ~~as seen here~~
66+
67+
Not supported:
68+
69+
* Task lists
70+
* Auto links (http://www.elastic.co)
71+
* Using a subset of html
72+

0 commit comments

Comments
 (0)