Skip to content

Commit ef12e07

Browse files
authored
📚 Implement MkDocs with Material Theme for Documentation Build System (#78)
## 🎯 Overview This PR implements MkDocs with the Material theme to generate HTML documentation from the existing `docs/` folder, integrates it with GitHub Actions, and ensures proper build artifacts management. ## 🔧 Changes Made ### Core Setup - ✅ **MkDocs Configuration**: Created `mkdocs.yml` with Material theme configuration - ✅ **Documentation Structure**: Configured MkDocs to build from `./docs/` source directory - ✅ **Output Directory**: Set output directory to `./site/docs/` (gitignored) - ✅ **Dependencies**: Added `requirements.docs.txt` for MkDocs and Material theme ### GitHub Actions Integration - ✅ **Workflow Updates**: Modified `.github/workflows/deploy-pages.yml` - Added Python setup step with dependency caching - Added MkDocs dependency installation - Added MkDocs build step before deployment - Updated workflow triggers to include `docs/**`, `mkdocs.yml`, and `requirements.docs.txt` changes - Added `fetch-depth: 0` for git-revision-date-localized plugin ### Repository Management - ✅ **Git Ignore**: Updated `.gitignore` to exclude `./site/docs/` directory - ✅ **Build Artifacts**: Generated documentation is treated as build artifact (not committed) - ✅ **Existing Structure**: Maintained existing `./site/` structure for other static assets ## 🚀 Features Implemented ### Material Theme Configuration - **Light/Dark Mode Toggle**: Automatic theme switching - **Navigation**: Tabs, sections, and expandable navigation - **Search**: Enhanced search with highlighting and sharing - **Code Features**: Syntax highlighting with copy buttons - **Mobile Responsive**: Optimized for mobile devices ### MkDocs Extensions - **Admonitions**: Call-out boxes for notes, warnings, etc. - **Code Highlighting**: Syntax highlighting with line numbers - **Tabbed Content**: Support for tabbed sections - **Table of Contents**: Auto-generated TOC with permalinks - **Git Integration**: Last modified dates from Git history ### Navigation Structure Organized documentation into logical sections: - **Getting Started**: Installation, Quick Start, Usage - **Configuration**: YAML Config, Template Variables, File Handling, Mappings - **Advanced Features**: Custom Structures, Hooks, GitHub Integration, Schema - **Development**: Dev Setup, Completion, Contributing - **Reference**: Examples, Articles, Known Issues, Funding ## 🧪 Testing - ✅ **Local Build**: `mkdocs build` successfully generates static HTML - ✅ **Output Directory**: Documentation generated in `./site/docs/` - ✅ **Git Ignore**: Generated files properly excluded from version control - ✅ **Material Theme**: Theme applied with proper styling and features - ✅ **Navigation**: All documented pages accessible through navigation ## 📝 Usage ### Local Development ```bash # Install dependencies pip install -r requirements.docs.txt # Serve documentation locally with live reload mkdocs serve # Build documentation mkdocs build ``` ### Production Deployment GitHub Actions will automatically: 1. Install Python and MkDocs dependencies 2. Build documentation with `mkdocs build` 3. Deploy to GitHub Pages alongside existing static assets ## 🔗 Closes Closes #77 ## 🚦 Checklist - [x] MkDocs installed and configured with Material theme - [x] Documentation builds from `./docs/` source directory - [x] Output directory set to `./site/docs/` - [x] `mkdocs.yml` configuration file created - [x] GitHub Actions workflow updated with MkDocs build step - [x] Python dependencies installation added to workflow - [x] Workflow triggers updated for documentation changes - [x] `.gitignore` updated to exclude `./site/docs/` - [x] Build artifacts properly managed (not committed) - [x] Local development supports `mkdocs serve` - [x] Documentation successfully builds and generates HTML ## 🔍 Additional Notes - The build process shows some warnings about missing documentation files referenced in existing docs. These can be addressed in future updates. - The Material theme provides excellent SEO, mobile responsiveness, and user experience. - The git-revision-date-localized plugin shows last modified dates for each page. - All existing static assets in `./site/` remain unchanged and will continue to work.
1 parent 21f19d5 commit ef12e07

File tree

4 files changed

+108
-0
lines changed

4 files changed

+108
-0
lines changed

.github/workflows/deploy-pages.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
branches: ["main"]
66
paths:
77
- "site/**"
8+
- "docs/**"
9+
- "mkdocs.yml"
10+
- "requirements.docs.txt"
811

912
workflow_dispatch:
1013

@@ -26,6 +29,22 @@ jobs:
2629
steps:
2730
- name: Checkout
2831
uses: actions/checkout@v4
32+
with:
33+
fetch-depth: 0 # Needed for git-revision-date-localized plugin
34+
35+
- name: Setup Python
36+
uses: actions/setup-python@v4
37+
with:
38+
python-version: '3.x'
39+
cache: 'pip'
40+
41+
- name: Install MkDocs dependencies
42+
run: |
43+
pip install -r requirements.docs.txt
44+
45+
- name: Build MkDocs documentation
46+
run: |
47+
mkdocs build
2948
3049
- name: Setup Pages
3150
uses: actions/configure-pages@v5

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@ __pycache__
55
*.log
66
example_project/
77
build/*
8+
9+
# MkDocs generated documentation
10+
site/docs/

mkdocs.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
site_name: STRUCT Documentation
2+
site_description: Automated Project Structure Generator
3+
site_url: https://httpdss.github.io/struct/
4+
repo_url: https://github.com/httpdss/struct
5+
repo_name: httpdss/struct
6+
7+
theme:
8+
name: material
9+
palette:
10+
# Palette toggle for light mode
11+
- scheme: default
12+
primary: blue
13+
accent: blue
14+
toggle:
15+
icon: material/brightness-7
16+
name: Switch to dark mode
17+
# Palette toggle for dark mode
18+
- scheme: slate
19+
primary: blue
20+
accent: blue
21+
toggle:
22+
icon: material/brightness-4
23+
name: Switch to light mode
24+
features:
25+
- navigation.tabs
26+
- navigation.sections
27+
- navigation.expand
28+
- navigation.top
29+
- search.highlight
30+
- search.share
31+
- content.code.copy
32+
- content.code.annotate
33+
34+
docs_dir: docs
35+
site_dir: site/docs
36+
37+
# Navigation structure based on existing docs
38+
nav:
39+
- Home: index.md
40+
- Getting Started:
41+
- Installation: installation.md
42+
- Quick Start: quickstart.md
43+
- Usage: usage.md
44+
- Configuration:
45+
- YAML Configuration: configuration.md
46+
- Template Variables: template-variables.md
47+
- File Handling: file-handling.md
48+
- Mappings: mappings.md
49+
- Advanced Features:
50+
- Custom Structures: structures.md
51+
- Hooks: hooks.md
52+
- GitHub Integration: github-integration.md
53+
- Schema Reference: schema.md
54+
- Development:
55+
- Development Setup: development.md
56+
- Command-Line Completion: completion.md
57+
- Contributing: contributing.md
58+
- Reference:
59+
- Examples: examples/index.md
60+
- Articles and Tutorials: articles.md
61+
- Known Issues: known-issues.md
62+
- Funding: funding.md
63+
64+
markdown_extensions:
65+
- admonition
66+
- pymdownx.details
67+
- pymdownx.superfences
68+
- pymdownx.highlight:
69+
anchor_linenums: true
70+
- pymdownx.inlinehilite
71+
- pymdownx.snippets
72+
- pymdownx.tabbed:
73+
alternate_style: true
74+
- attr_list
75+
- md_in_html
76+
- tables
77+
- toc:
78+
permalink: true
79+
80+
plugins:
81+
- search
82+
- git-revision-date-localized:
83+
enable_creation_date: true

requirements.docs.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
mkdocs>=1.5.0
2+
mkdocs-material>=9.0.0
3+
mkdocs-git-revision-date-localized-plugin>=1.2.0

0 commit comments

Comments
 (0)