diff --git a/README.md b/README.md index 231ec36..5ae244c 100644 --- a/README.md +++ b/README.md @@ -82,6 +82,15 @@ node tools/update-frontmatter.js node tools/update-frontmatter.js algorithms/sorting-algorithms.md ``` +#### Generating Table of Contents + +The `generate_summary.py` script automatically creates the SUMMARY.md file: + +```bash +# Run the script to generate a new table of contents +python tools/generate_summary.py +``` + For more information about available tools, see the [Tools README](tools/README.md). ## 🤝 Contribution diff --git a/README_vi.md b/README_vi.md index cfaa252..65d70ca 100644 --- a/README_vi.md +++ b/README_vi.md @@ -83,6 +83,15 @@ node tools/update-frontmatter.js node tools/update-frontmatter.js algorithms/sorting-algorithms.md ``` +#### Tạo mục lục tự động + +Script `generate_summary.py` tự động tạo file SUMMARY.md: + +```bash +# Chạy script để tạo mục lục mới +python tools/generate_summary.py +``` + Để biết thêm thông tin về các công cụ có sẵn, hãy xem [README của Tools](tools/README.md). ## 🤝 Đóng góp diff --git a/SUMMARY.md b/SUMMARY.md index 3497c69..f2396d3 100644 --- a/SUMMARY.md +++ b/SUMMARY.md @@ -5,6 +5,7 @@ ### Algorithms - [Graph Traversal Algorithms](docs/algorithms/graph-traversal.md) +- [Sorting Algorithms](docs/algorithms/sorting-algorithms.md) ### Databases diff --git a/tools/README.md b/tools/README.md index 0b33335..a093bbe 100644 --- a/tools/README.md +++ b/tools/README.md @@ -33,7 +33,7 @@ A Node.js script that automatically updates the frontmatter (metadata) in all Ma ```bash # Install dependencies if not already installed -npm install gray-matter glob +npm install # Make the script executable chmod +x tools/update-frontmatter.js @@ -55,6 +55,38 @@ node tools/update-frontmatter.js algorithms/sorting-algorithms.md # - /i18n/vi/algorithms/sorting-algorithms.md ``` +### `generate_summary.py` + +A Python script that automatically generates the `SUMMARY.md` file by scanning the `docs/` directory structure. + +#### Features + +- Creates a well-structured table of contents +- Extracts titles from Markdown files when available +- Organizes content by categories based on directory structure +- Generates clean, formatted links to all documentation files + +#### Requirements + +- Python 3.6+ +- No external dependencies (uses only standard library) + +#### Usage + +```bash +# Make the script executable (first time only) +chmod +x tools/generate_summary.py + +# Run the script to generate SUMMARY.md +python tools/generate_summary.py +``` + +The script will: +1. Scan all directories in `/docs` +2. Extract titles from Markdown files or generate them from filenames +3. Create a hierarchical table of contents +4. Write the result to `SUMMARY.md` in the project root + #### Automation This script is configured to run automatically via GitHub Actions when: