GitHub Pages Deployment Guide: Interactive Mind Maps¶
This guide explains how to deploy mind maps to GitHub Pages with full interactive functionality.
π Complete Workflow Diagram¶
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Mind Map Generation & Deployment Flow β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β ββββββββββββ ββββββββββββ ββββββββββββ ββββββββββββ β
β β Source β βββ β Generator β βββ β Output β βββ β GitHub β β
β ββββββββββββ ββββββββββββ ββββββββββββ β Pages β β
β ββββββββββββ β
β β’ ontology/*.toml generate_ β’ *.md (static) β
β β’ meta/problems/ mindmaps.py β’ *.html (interactive) Auto β
β β’ Any text text_to_ Deploy β
β mindmap.py β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
ποΈ Directory Structure¶
neetcode/
βββ docs/
β βββ mindmaps/
β β βββ index.md # Mind map index
β β βββ pattern_hierarchy.md # Static Markdown version
β β βββ algorithm_usage.md
β β βββ ...
β β
β βββ pages/ # π GitHub Pages root (gitignored)
β β βββ mindmaps/ # Interactive HTML mind maps
β β β βββ pattern_hierarchy.html
β β β βββ ...
β β βββ ...
β β
β βββ stylesheets/ # Custom CSS
β βββ index.md # Homepage (includes README.md)
β βββ index_zh-TW.md # Homepage (Traditional Chinese)
β βββ GITHUB_PAGES_SETUP.md # This file
β
βββ tools/
β βββ generate_mindmaps.py # Generate from ontology
β βββ text_to_mindmap.py # Generate from any text
β βββ generate_mindmaps.toml # Configuration
β
βββ .github/
β βββ workflows/
β βββ deploy-pages.yml # π Auto deployment
β
βββ mkdocs.yml # MkDocs configuration
βββ site/ # π MkDocs build output (gitignored)
π Quick Start: Local Development¶
Build MkDocs Documentation Locally¶
Before deploying to GitHub Pages, you can preview the documentation locally:
# 1. Activate virtual environment
# Windows
.\leetcode\Scripts\activate.ps1
# Linux/macOS
source leetcode/bin/activate
# 2. Install dependencies (if not already installed)
pip install -r requirements.txt
# 3. Build MkDocs site
python -m mkdocs build
# 4. Preview locally
python -m mkdocs serve
# Visit http://127.0.0.1:8000
Output: The built site will be in the site/ directory.
Generate Mind Maps Locally¶
# Generate Markdown mind maps
python tools/generate_mindmaps.py
# Generate HTML (interactive) mind maps
python tools/generate_mindmaps.py --html
# Use autoloader mode
python tools/generate_mindmaps.py --html --autoloader
Note: Generated HTML files are saved to docs/pages/mindmaps/ (gitignored).
Step 1: Setup MkDocs Configuration¶
1.1 Install Dependencies¶
1.2 Configure mkdocs.yml¶
The mkdocs.yml file is already configured with: - Material theme - include-markdown plugin (includes README.md directly) - Custom CSS for badges and tables - Navigation structure
Step 2: Build and Preview Locally¶
2.1 Build Documentation¶
2.2 Preview Locally¶
# Start development server
python -m mkdocs serve
# Visit http://127.0.0.1:8000
# The server auto-reloads on file changes
2.3 Common Build Commands¶
# Build with verbose output
python -m mkdocs build --verbose
# Build and check for broken links
python -m mkdocs build --strict
# Clean build (remove site/ directory first)
rm -rf site/ # Linux/macOS
Remove-Item -Recurse -Force site/ # Windows PowerShell
python -m mkdocs build
Step 3: Generate Interactive Mind Maps¶
3.1 Generate Rule-Based HTML Mind Maps¶
# Generate all interactive mind maps (rule-based)
python tools/generate_mindmaps.py --html
# Generate specific mind map
python tools/generate_mindmaps.py --html --type pattern_hierarchy
# Use autoloader mode (optional)
python tools/generate_mindmaps.py --html --autoloader
Output: HTML files are generated in docs/pages/mindmaps/
3.2 Generate AI-Powered Mind Maps (Manual Process)¶
β οΈ Important: AI mindmaps are NOT automatically generated in CI/CD. You must generate them manually and commit the HTML files.
Why manual? - Requires OpenAI API key (should not be stored in CI/CD) - API calls cost money (better to control when to regenerate) - Allows review before committing
Steps:
-
Set up API key locally:
-
Generate AI mindmaps:
-
Verify generated files:
-
Review prompt file (optional but recommended):
- The prompt used for generation is saved to
tools/prompts/generated/mindmap_prompt.md - This file is tracked in Git for traceability β you can always see which prompt generated each version of the AI mind maps
-
Review the prompt to ensure it matches your expectations
-
Commit and push:
-
CI/CD will automatically deploy the committed HTML files.
Why track the prompt file? - Traceability: You can always see which prompt was used to generate each version of AI mind maps - Reproducibility: Others can understand how the mind maps were generated - Transparency: Makes the AI generation process transparent and auditable
Configuration: - Edit tools/mindmap_ai_config.toml to customize: - Output language(s): language = ["en", "zh-TW"] - HTML generation: generate_html = true - Output directory: html_directory = "docs/pages/mindmaps"
Note: The .gitignore file is configured to track AI mindmap HTML files:
docs/pages/ # Ignore all generated HTML
!docs/pages/mindmaps/neetcode_ontology_ai_*.html # But track AI mindmaps
Prompt File Tracking: - The prompt file tools/prompts/generated/mindmap_prompt.md is tracked in Git - This ensures full traceability β you can always see which prompt generated each AI mind map version - The prompt file is automatically updated each time you run generate_mindmaps_ai.py
3.3 Preview Mind Maps Locally¶
# Method 1: Open HTML directly
# Windows
start docs/pages/mindmaps/pattern_hierarchy.html
# Linux/macOS
open docs/pages/mindmaps/pattern_hierarchy.html
# Method 2: Use HTTP server
cd docs/pages
python -m http.server 8000
# Visit http://localhost:8000/mindmaps/pattern_hierarchy.html
Step 4: Configure GitHub Actions for Auto Deployment¶
4.1 Workflow Configuration¶
The .github/workflows/deploy-pages.yml file handles automatic deployment:
# .github/workflows/deploy-pages.yml
name: Deploy Documentation to GitHub Pages
on:
push:
branches: [main]
paths:
- 'docs/**'
- 'mkdocs.yml'
- 'requirements.txt'
- 'ontology/**'
- 'meta/**'
workflow_dispatch: # Allow manual trigger
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: pip install -r requirements.txt
- name: Generate rule-based mind maps
run: python tools/generate_mindmaps.py --html
# Note: AI mindmaps are NOT generated in CI/CD
# They must be manually generated and committed to the repository
# See Step 3.2 for manual generation instructions
- name: Build MkDocs site
run: python -m mkdocs build
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: 'site'
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
Step 5: Enable GitHub Pages¶
5.1 GitHub Settings¶
- Go to your Repository β Settings
- Find Pages in the left sidebar
- Under "Source", select GitHub Actions
5.2 First Deployment¶
# 1. Ensure file structure is correct
# 2. Commit and push
git add .
git commit -m "feat: setup GitHub Pages with MkDocs"
git push origin main
# 3. GitHub Actions will automatically deploy
# 4. Visit: https://yourusername.github.io/neetcode/
Step 6: Update README with Links¶
The README.md already includes links to interactive mind maps:
## π§ Interactive Mind Maps
| Mind Map | Description | Links |
|:---------|:------------|:------|
| π Pattern Hierarchy | API Kernels β Patterns β Problems | [Static](docs/mindmaps/pattern_hierarchy.md) Β· [Interactive β¨](https://lufftw.github.io/neetcode/mindmaps/#pattern-hierarchy) |
| π¨βπ©βπ§βπ¦ Family Derivation | Base templates β Derived variants | [Static](docs/mindmaps/family_derivation.md) Β· [Interactive β¨](https://lufftw.github.io/neetcode/mindmaps/#family-derivation) |
| β‘ Algorithm Usage | Problems by algorithm | [Static](docs/mindmaps/algorithm_usage.md) Β· [Interactive β¨](https://lufftw.github.io/neetcode/mindmaps/#algorithm-usage) |
| ποΈ Data Structure Usage | Problems by data structure | [Static](docs/mindmaps/data_structure.md) Β· [Interactive β¨](https://lufftw.github.io/neetcode/mindmaps/#data-structure-usage) |
| π’ Company Coverage | Company-specific problems | [Static](docs/mindmaps/company_coverage.md) Β· [Interactive β¨](https://lufftw.github.io/neetcode/mindmaps/#company-coverage) |
| πΊοΈ Learning Roadmaps | NeetCode 150, Blind 75, etc. | [Static](docs/mindmaps/roadmap_paths.md) Β· [Interactive β¨](https://lufftw.github.io/neetcode/mindmaps/#learning-roadmaps) |
| π Problem Relations | Related problems network | [Static](docs/mindmaps/problem_relations.md) Β· [Interactive β¨](https://lufftw.github.io/neetcode/mindmaps/#problem-relations) |
| π Solution Variants | Multiple approaches | [Static](docs/mindmaps/solution_variants.md) Β· [Interactive β¨](https://lufftw.github.io/neetcode/mindmaps/#solution-variants) |
| π Difficulty Γ Topics | Topics by difficulty | [Static](docs/mindmaps/difficulty_topics.md) Β· [Interactive β¨](https://lufftw.github.io/neetcode/mindmaps/#difficulty-topics) |
π **[View All Interactive Mind Maps](https://lufftw.github.io/neetcode/mindmaps/)**
π Complete Workflow Summary¶
Rule-Based Mind Maps (Auto-Generated in CI/CD)¶
1. Edit ontology/ or meta/problems/
β
2. git push
β
3. GitHub Actions automatically triggers
β
4. Generate rule-based mind maps (Markdown + HTML)
python tools/generate_mindmaps.py --html
β
5. Build MkDocs site
python -m mkdocs build
β
6. Deploy to GitHub Pages
β
7. Visit https://yourusername.github.io/neetcode/
AI-Powered Mind Maps (Manual Process)¶
1. Set up OpenAI API key locally
$env:OPENAI_API_KEY = "sk-..."
β
2. Generate AI mindmaps locally
python tools/generate_mindmaps_ai.py
β
3. Review generated HTML files
docs/pages/mindmaps/neetcode_ontology_ai_*.html
β
4. Commit and push
git add docs/pages/mindmaps/neetcode_ontology_ai_*.html
git commit -m "docs: Update AI mind maps"
git push
β
5. GitHub Actions automatically triggers
β
6. Build MkDocs site (uses committed AI mindmap HTML files)
python -m mkdocs build
β
7. Deploy to GitHub Pages
β
8. Visit https://yourusername.github.io/neetcode/mindmaps/
Using Interactive Mind Maps¶
- π±οΈ Drag to pan
- π Scroll to zoom
- π Click to fold/unfold
β Frequently Asked Questions¶
Q: Why can't GitHub README display interactive content directly?¶
A: GitHub disables JavaScript execution for security reasons. GitHub Pages is needed to host the interactive version.
Q: Can I use a custom domain?¶
A: Yes! Configure it in Settings β Pages β Custom domain.
Q: How do I update mind maps?¶
For rule-based mind maps: After modifying ontology/ or meta/, push to GitHub. GitHub Actions will automatically regenerate and redeploy.
For AI-powered mind maps: 1. Generate locally with python tools/generate_mindmaps_ai.py 2. Commit the generated HTML files (docs/pages/mindmaps/neetcode_ontology_ai_*.html) 3. Also commit the prompt file (tools/prompts/generated/mindmap_prompt.md) for traceability 4. Push to GitHub 5. CI/CD will automatically deploy the committed files
Why commit the prompt file? The prompt file is tracked in Git so you can always see which prompt was used to generate each version of the AI mind maps. This provides full traceability and transparency.
Why manual for AI mindmaps? - Requires OpenAI API key (not stored in CI/CD for security) - Allows cost control (you decide when to regenerate) - Enables review before committing
Q: How do I preview locally?¶
A:
For MkDocs documentation:
For interactive mind maps:
# Method 1: Open HTML directly
open docs/pages/mindmaps/pattern_hierarchy.html
# Method 2: Use HTTP server
cd docs/pages
python -m http.server 8000
# Visit http://localhost:8000/mindmaps/pattern_hierarchy.html
Q: How do I fix MkDocs build warnings?¶
A: Common fixes: - Remove anchor links from Table of Contents (MkDocs auto-generates navigation) - Change relative links to .dev/ to GitHub full URLs - Ensure all referenced files exist in docs/ directory
Q: What's the difference between site/ and docs/pages/?¶
A: - site/ - MkDocs build output (contains full documentation site) - docs/pages/ - Generated HTML mind maps (used by GitHub Pages)
Both are gitignored and regenerated on build/deploy.
π Notes¶
- Local Development: Always test locally with
python -m mkdocs buildandpython -m mkdocs servebefore pushing - Build Output: The
site/directory contains the complete MkDocs site and is gitignored - Mind Maps: HTML mind maps are generated to
docs/pages/mindmaps/and are also gitignored - Auto Deployment: GitHub Actions handles generation, building, and deployment automatically