Skip to content

Commit 3ffd8eb

Browse files
kylehounslowasifabashar
authored andcommitted
Migrate PPL Documentation from RST to Markdown (opensearch-project#4912)
1 parent 2943826 commit 3ffd8eb

156 files changed

Lines changed: 20383 additions & 16579 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

DEVELOPER_GUIDE.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ Here are other files and sub-folders that you are likely to touch:
172172

173173
- ``build.gradle``: Gradle build script.
174174
- ``docs``: documentation for developers and reference manual for users.
175-
- ``doc-test``: code that run .rst docs in ``docs`` folder by Python doctest library.
175+
- ``doctest``: code that runs .rst and .md docs in ``docs`` folder by Python doctest library.
176176

177177
Note that other related project code has already merged into this single repository together:
178178

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ Recently we have been actively improving our query engine primarily for better c
8888

8989
## Documentation
9090

91-
Please refer to the [SQL Language Reference Manual](./docs/user/index.rst), [Piped Processing Language (PPL) Reference Manual](./docs/user/ppl/index.rst), [OpenSearch SQL/PPL Engine Development Manual](./docs/dev/index.md) and [Technical Documentation](https://opensearch.org/docs/latest/search-plugins/sql/index/) for detailed information on installing and configuring plugin.
91+
Please refer to the [SQL Language Reference Manual](./docs/user/index.rst), [Piped Processing Language (PPL) Reference Manual](./docs/user/ppl/index.md), [OpenSearch SQL/PPL Engine Development Manual](./docs/dev/index.md) and [Technical Documentation](https://opensearch.org/docs/latest/search-plugins/sql/index/) for detailed information on installing and configuring plugin.
9292

9393
## Forum
9494

docs/category.json

Lines changed: 56 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,61 @@
44
"user/admin/settings.rst"
55
],
66
"bash_calcite": [
7-
"user/ppl/interfaces/endpoint.rst",
8-
"user/ppl/interfaces/protocol.rst"
7+
"user/ppl/interfaces/endpoint.md",
8+
"user/ppl/interfaces/protocol.md"
9+
],
10+
"ppl_cli_calcite": [
11+
"user/ppl/cmd/ad.md",
12+
"user/ppl/cmd/append.md",
13+
"user/ppl/cmd/bin.md",
14+
"user/ppl/cmd/dedup.md",
15+
"user/ppl/cmd/describe.md",
16+
"user/ppl/cmd/eventstats.md",
17+
"user/ppl/cmd/eval.md",
18+
"user/ppl/cmd/fields.md",
19+
"user/ppl/cmd/fillnull.md",
20+
"user/ppl/cmd/grok.md",
21+
"user/ppl/cmd/head.md",
22+
"user/ppl/cmd/join.md",
23+
"user/ppl/cmd/lookup.md",
24+
"user/ppl/cmd/parse.md",
25+
"user/ppl/cmd/patterns.md",
26+
"user/ppl/cmd/rare.md",
27+
"user/ppl/cmd/regex.md",
28+
"user/ppl/cmd/rename.md",
29+
"user/ppl/cmd/multisearch.md",
30+
"user/ppl/cmd/replace.md",
31+
"user/ppl/cmd/rex.md",
32+
"user/ppl/cmd/search.md",
33+
"user/ppl/cmd/showdatasources.md",
34+
"user/ppl/cmd/sort.md",
35+
"user/ppl/cmd/spath.md",
36+
"user/ppl/cmd/stats.md",
37+
"user/ppl/cmd/streamstats.md",
38+
"user/ppl/cmd/subquery.md",
39+
"user/ppl/cmd/syntax.md",
40+
"user/ppl/cmd/chart.md",
41+
"user/ppl/cmd/timechart.md",
42+
"user/ppl/cmd/top.md",
43+
"user/ppl/cmd/trendline.md",
44+
"user/ppl/cmd/where.md",
45+
"user/ppl/functions/aggregations.md",
46+
"user/ppl/functions/collection.md",
47+
"user/ppl/functions/condition.md",
48+
"user/ppl/functions/conversion.md",
49+
"user/ppl/functions/cryptographic.md",
50+
"user/ppl/functions/datetime.md",
51+
"user/ppl/functions/expressions.md",
52+
"user/ppl/functions/ip.md",
53+
"user/ppl/functions/json.md",
54+
"user/ppl/functions/math.md",
55+
"user/ppl/functions/relevance.md",
56+
"user/ppl/functions/statistical.md",
57+
"user/ppl/functions/string.md",
58+
"user/ppl/functions/system.md",
59+
"user/ppl/general/comments.md",
60+
"user/ppl/general/datatypes.md",
61+
"user/ppl/general/identifiers.md"
962
],
1063
"sql_cli": [
1164
"user/dql/expressions.rst",
@@ -21,57 +74,7 @@
2174
"user/dql/complex.rst",
2275
"user/dql/metadata.rst"
2376
],
24-
"ppl_cli_calcite": [
25-
"user/ppl/cmd/ad.rst",
26-
"user/ppl/cmd/append.rst",
27-
"user/ppl/cmd/bin.rst",
28-
"user/ppl/cmd/dedup.rst",
29-
"user/ppl/cmd/describe.rst",
30-
"user/ppl/cmd/eventstats.rst",
31-
"user/ppl/cmd/eval.rst",
32-
"user/ppl/cmd/fields.rst",
33-
"user/ppl/cmd/fillnull.rst",
34-
"user/ppl/cmd/grok.rst",
35-
"user/ppl/cmd/head.rst",
36-
"user/ppl/cmd/join.rst",
37-
"user/ppl/cmd/lookup.rst",
38-
"user/ppl/cmd/parse.rst",
39-
"user/ppl/cmd/patterns.rst",
40-
"user/ppl/cmd/rare.rst",
41-
"user/ppl/cmd/regex.rst",
42-
"user/ppl/cmd/rename.rst",
43-
"user/ppl/cmd/multisearch.rst",
44-
"user/ppl/cmd/replace.rst",
45-
"user/ppl/cmd/rex.rst",
46-
"user/ppl/cmd/search.rst",
47-
"user/ppl/cmd/showdatasources.rst",
48-
"user/ppl/cmd/sort.rst",
49-
"user/ppl/cmd/spath.rst",
50-
"user/ppl/cmd/stats.rst",
51-
"user/ppl/cmd/streamstats.rst",
52-
"user/ppl/cmd/subquery.rst",
53-
"user/ppl/cmd/syntax.rst",
54-
"user/ppl/cmd/chart.rst",
55-
"user/ppl/cmd/timechart.rst",
56-
"user/ppl/cmd/search.rst",
57-
"user/ppl/functions/statistical.rst",
58-
"user/ppl/cmd/top.rst",
59-
"user/ppl/cmd/trendline.rst",
60-
"user/ppl/cmd/where.rst",
61-
"user/ppl/functions/collection.rst",
62-
"user/ppl/functions/condition.rst",
63-
"user/ppl/functions/datetime.rst",
64-
"user/ppl/functions/expressions.rst",
65-
"user/ppl/functions/ip.rst",
66-
"user/ppl/functions/json.rst",
67-
"user/ppl/functions/math.rst",
68-
"user/ppl/functions/relevance.rst",
69-
"user/ppl/functions/string.rst",
70-
"user/ppl/functions/conversion.rst",
71-
"user/ppl/general/datatypes.rst",
72-
"user/ppl/general/identifiers.rst"
73-
],
7477
"bash_settings": [
75-
"user/ppl/admin/settings.rst"
78+
"user/ppl/admin/settings.md"
7679
]
7780
}

docs/dev/intro-v3-engine.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ Find more details in [V3 Architecture](./intro-v3-architecture.md).
2626

2727
In the initial release of the V3 engine (3.0.0), the main new features focus on enhancing the PPL language while maintaining maximum compatibility with V2 behavior.
2828

29-
* **[Join](../user/ppl/cmd/join.rst) Command**
30-
* **[Lookup](../user/ppl/cmd/lookup.rst) Command**
31-
* **[Subquery](../user/ppl/cmd/subquery.rst) Command**
29+
* **[Join](../user/ppl/cmd/join.md) Command**
30+
* **[Lookup](../user/ppl/cmd/lookup.md) Command**
31+
* **[Subquery](../user/ppl/cmd/subquery.md) Command**
3232

3333
V3 (Calcite integration) engine is enabled by default in 3.3.0.
3434

docs/dev/ppl-commands.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,4 @@ If you are working on contributing a new PPL command, please read this guide and
5454
- Add a test in `CrossClusterSearchIT`
5555

5656
- [ ] **User doc:**
57-
- Add a xxx.rst under `docs/user/ppl/cmd` and link the new doc to `docs/user/ppl/index.rst`
57+
- Add a xxx.md under `docs/user/ppl/cmd` and link the new doc to `docs/user/ppl/index.md`

docs/dev/testing-doctest.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,58 @@ Doctest runs with project build by `./gradlew build`. You can also only run doct
5757
Make sure you don't have any OpenSearch instance running at `http://localhost:9200`
5858

5959
### 1.4.2 How to write documentation with doctest?
60+
61+
#### RST Format (SQL docs only. On Deprecation path. Use markdown for PPL)
6062
1. If you want to add a new doc, you can add it to `docs` folder, under correct sub-folder, in `.rst` format.
6163
> **Attention**: For code examples in documentation, a Mixing usage of `cli` and `bash` in one doc is not supported yet.
6264
2. Add your new doc file path to `docs/category.json` by its category
6365
3. Run doctest `./gradlew doctest` (optionally with `-DignorePrometheus`) to see if your tests can pass
6466

67+
#### Markdown Format (New - Currently for docs/user/ppl only)
68+
For PPL documentation, Markdown format is now supported with the following guidelines:
69+
70+
1. **File Format**: Create `.md` file(s) in `docs/user/ppl` folder
71+
2. **Category Configuration**: Add markdown files to markdown-only categories in `docs/category.json`:
72+
- `ppl_cli_calcite`: PPL CLI examples with Calcite engine
73+
- `bash_calcite`: Bash/curl examples with Calcite engine
74+
- `bash_settings`: Bash examples for settings/configuration
75+
76+
3. **Code Block Format**: Use **paired** fenced code blocks - each input block must be followed by its expected output block:
77+
78+
```ppl
79+
search source=accounts | where age > 25 | fields firstname, lastname
80+
```
81+
82+
Expected output:
83+
84+
```text
85+
+-------------+------------+
86+
| firstname | lastname |
87+
|-------------+------------|
88+
| Amber | Duke |
89+
| Hattie | Bond |
90+
+-------------+------------+
91+
```
92+
93+
**Input/Output Pairs**: Each input code fence must be immediately followed by an "Expected output:" section with an output code fence
94+
- **Supported Input Languages**: `sql`, `ppl`, `bash`, `sh`, `bash ppl`
95+
- **Supported Output Languages**: `text`, `console`, `output`, `json`, `yaml`
96+
97+
4. **Ignoring Tests**: To skip specific code blocks from testing, add `ignore` attribute:
98+
99+
```ppl ignore
100+
search source=accounts | head 5
101+
```
102+
103+
Expected output:
104+
105+
```text
106+
This output won't be tested
107+
```
108+
109+
5. **Validation**: Markdown categories only accept `.md` files - mixing with `.rst` files will cause validation errors
110+
6. **Testing**: Run `./gradlew doctest` to validate your markdown documentation
111+
65112
Currently, there is a `sample` folder under `docs` module to help you get started.
66113

67114
## 1.5 Future Plan

0 commit comments

Comments
 (0)