Skip to content

Commit 24ba085

Browse files
committed
Configured mkdocs and have it auto-generate markdown files including the html snippets for each file under 'docs/tmp/'
1 parent 91c8be4 commit 24ba085

File tree

367 files changed

+781695
-1
lines changed

Some content is hidden

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

367 files changed

+781695
-1
lines changed

bin/generate_reference_pages.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import os
2+
from pathlib import Path
3+
4+
def generate_pages(path, output_dir, parent):
5+
with os.scandir(path) as it:
6+
for folder in it:
7+
dir_name = folder.name + ".md"
8+
# print(dir_name)
9+
# Make md file storing its snippet
10+
file_path = os.path.join(output_dir, dir_name)
11+
12+
with open(file_path, 'w') as f:
13+
f.write(f'# {folder.name}\n')
14+
f.write(f'--8<-- \"{parent}/{folder.name}/index.html\"\n')
15+
16+
it.close()
17+
18+
# Walk through the docs/tmp/ directory and generate .md files that include the html snippets in it
19+
parent = Path(__file__).resolve().parents[1]
20+
ref_path = f"{parent}/docs/tmp/reference"
21+
ref_output_dir = f"{parent}/pages/reference/"
22+
23+
examples_path = f"{parent}/docs/tmp/javascript"
24+
examples_output_dir = f"{parent}/pages/examples/"
25+
26+
# Make directories if it doesn't exist
27+
os.makedirs(ref_output_dir, exist_ok=True)
28+
os.makedirs(examples_output_dir, exist_ok=True)
29+
30+
generate_pages(ref_path, ref_output_dir, "reference")
31+
generate_pages(examples_path, examples_output_dir, "javascript")
32+

0 commit comments

Comments
 (0)