Skip to content

Commit 3e85a74

Browse files
committed
add auto outline script
1 parent 567433f commit 3e85a74

7 files changed

Lines changed: 56 additions & 14 deletions

File tree

.github/workflows/build_and_deploy_docs.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ jobs:
2727
- name: Build and deploy
2828
working-directory: readme_assets
2929
run: |
30-
mv ../docs/mkdocs.yml .
3130
mv ../docs .
31+
python docs/outline.py
32+
mv docs/mkdocs.yml .
3233
mkdocs build
3334
mkdocs gh-deploy --force
File renamed without changes.

docs/Tutorials/agent.md

Whitespace-only changes.

docs/index.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
Welcome to AWorld’s Documentation!
1+
# Welcome to AWorld’s Documentation!
22

3-
## Get Started
3+
## Quickstart
44

5-
[Installation](./index.md)
5+
[Installation](Quickstart/install.md)
66

7-
## Tutorials
8-
9-
[Workflow Construction](Basic%20usage/workflow_construction.md)
7+
[Workflow Construction](Quickstart/workflow_construction.md)
108

11-
## Advanced Tutorials
9+
## Tutorials
1210

1311
## API

docs/mkdocs.yml

Lines changed: 0 additions & 6 deletions
This file was deleted.

docs/outline.py

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import os
2+
from typing import List
3+
4+
import yaml
5+
6+
root = "../docs"
7+
black_keys = ["index"]
8+
black_values = ["index.md"]
9+
10+
11+
def scan_path(path: str) -> List[dict]:
12+
items = scan(path)
13+
res = []
14+
for k, v in items.items():
15+
if k in black_keys and v in black_values:
16+
continue
17+
18+
res.append({k: v})
19+
return res
20+
21+
22+
def scan(path: str):
23+
items = {}
24+
for name in sorted(os.listdir(path)):
25+
p = os.path.join(path, name)
26+
if name.startswith("."):
27+
continue
28+
29+
if os.path.isdir(p):
30+
children = scan(p)
31+
if children:
32+
items[name] = children
33+
elif name.endswith(".md"):
34+
items[os.path.splitext(name)[0]] = os.path.relpath(p, root).replace(os.sep, "/")
35+
return items
36+
37+
38+
if __name__ == '__main__':
39+
cfg = {
40+
"site_name": "AWorld Docs",
41+
"site_url": "https://github.com/inclusionAI/AWorld",
42+
"repo_url": "https://github.com/inclusionAI/AWorld",
43+
"copyright": "inclusionAI",
44+
"theme": "readthedocs",
45+
"nav": scan_path(root),
46+
}
47+
48+
with open('mkdocs.yml', 'w') as outfile:
49+
yaml.safe_dump(cfg, outfile, sort_keys=False, allow_unicode=True)

0 commit comments

Comments
 (0)