Skip to content

Commit d9c344e

Browse files
committed
Update docs
1 parent ee27f2a commit d9c344e

File tree

1 file changed

+48
-1
lines changed

1 file changed

+48
-1
lines changed

docs/syntax/version-variables.md

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,54 @@ can be printed in any kind of ways.
2626
| `{{version.stack | M+1 | M }}` | {{version.stack | M+1 | M }} |
2727
| `{{version.stack.base | M.M+1 }}` | {{version.stack.base | M.M+1 }} |
2828

29-
## Available versioning schemes.
29+
## Mutation Operators in Links and Code Blocks
30+
31+
Mutation operators also work correctly in links and code blocks, making them versatile for various documentation contexts.
32+
33+
### In Links
34+
35+
Mutation operators can be used in both link URLs and link text:
36+
37+
```markdown
38+
[Download version {{version.stack | M.M}}](https://download.elastic.co/{{version.stack | M.M}}/elasticsearch.tar.gz)
39+
[Latest major version](https://elastic.co/guide/en/elasticsearch/reference/{{version.stack | M}}/index.html)
40+
```
41+
42+
Which renders as:
43+
44+
[Download version {{version.stack | M.M}}](https://download.elastic.co/{{version.stack | M.M}}/elasticsearch.tar.gz)
45+
[Latest major version](https://elastic.co/guide/en/elasticsearch/reference/{{version.stack | M}}/index.html)
46+
47+
### In Code Blocks
48+
49+
Mutation operators work in enhanced code blocks when `subs=true` is specified:
50+
51+
````markdown
52+
```bash subs=true
53+
curl -X GET "localhost:9200/_cluster/health?v&pretty"
54+
echo "Elasticsearch {{version.stack | M.M}} is running"
55+
```
56+
````
57+
58+
Which renders as:
59+
60+
```bash subs=true
61+
curl -X GET "localhost:9200/_cluster/health?v&pretty"
62+
echo "Elasticsearch {{version.stack | M.M}} is running"
63+
```
64+
65+
### Whitespace Handling
66+
67+
Mutation operators are robust and handle whitespace around the pipe character correctly:
68+
69+
| Syntax | Result | Notes |
70+
|--------|--------| ----- |
71+
| `{{version.stack|M.M}}` | {{version.stack|M.M}} | No spaces |
72+
| `{{version.stack | M.M}}` | {{version.stack | M.M}} | Spaces around pipe |
73+
| `{{version.stack |M.M}}` | {{version.stack |M.M}} | Space before pipe |
74+
| `{{version.stack| M.M}}` | {{version.stack| M.M}} | Space after pipe |
75+
76+
## Available versioning schemes
3077

3178
This is dictated by the [`versions.yml`](https://github.com/elastic/docs-builder/blob/main/config/versions.yml) configuration file
3279

0 commit comments

Comments
 (0)