Skip to content

Conversation

@YosefAshenafi
Copy link
Contributor

@YosefAshenafi YosefAshenafi commented Nov 13, 2025

Summary

This PR configures MkDocs to build a comprehensive documentation website for Django HTK that automatically uses all README.md files from the repository. The documentation will be automatically deployed to GitHub Pages.

Changes

Documentation Configuration

  • mkdocs.yml: Complete MkDocs Material theme configuration featuring:
    • Navigation structure that mirrors the repository hierarchy
    • All 180+ auto-generated README files organized by module and app
    • Material theme with light/dark mode support
    • Search functionality with offline support
    • Code syntax highlighting and copy functionality
    • Comprehensive markdown extensions

GitHub Pages Deployment

  • .github/workflows/deploy-docs.yml: CI/CD workflow that:

Dependencies & Configuration

  • docs-requirements.txt: MkDocs and plugin dependencies
  • Updated .gitignore to exclude MkDocs build artifacts (site/)

Documentation Structure

The navigation hierarchy automatically follows the repository structure:

Core Modules

  • Admin utilities, API endpoints, Cache management, Constants, Decorators, Extensions, Forms, Middleware, Models, Utils, Validators

Django Apps (29 apps)

  • Accounts, Changelog, Organizations, CPQ, File Storage, and 24+ additional feature apps

Library Integrations (40+ integrations)

  • Google, Stripe, Slack, AWS, GitHub, and comprehensive third-party service wrappers

Utilities & Testing

  • Test scaffolding, Scripts, Template tags, and utility functions

Prerequisites

This PR depends on:

  • #507 - Documentation automation system with 180+ generated README files

Building & Testing

Build documentation locally:

pip install -r docs-requirements.txt
mkdocs build
mkdocs serve  # Preview at http://127.0.0.1:8000/

Deployment

Once merged, the documentation will be automatically:

  1. Built by GitHub Actions when changes are pushed
  2. Deployed to GitHub Pages at https://hacktoolkit.github.io/django-htk/
  3. Updated on every commit to the gh-pages branch

Screenshot

homepages

🤖 Generated with Claude Code

Co-Authored-By: Claude noreply@anthropic.com

@YosefAshenafi YosefAshenafi changed the base branch from master to README-file-generated November 13, 2025 00:34
@YosefAshenafi YosefAshenafi changed the base branch from README-file-generated to master November 13, 2025 07:16
@YosefAshenafi YosefAshenafi changed the base branch from master to README-file-generated November 13, 2025 07:16
@YosefAshenafi YosefAshenafi changed the base branch from README-file-generated to master November 13, 2025 14:32
@YosefAshenafi YosefAshenafi changed the base branch from master to README-file-generated November 13, 2025 14:33
@YosefAshenafi YosefAshenafi reopened this Nov 13, 2025
@YosefAshenafi YosefAshenafi self-assigned this Nov 13, 2025
@YosefAshenafi YosefAshenafi changed the base branch from README-file-generated to master November 14, 2025 05:17
Adds mkdocs configuration and documentation infrastructure:
- mkdocs.yml: MkDocs site configuration
- docs/: Documentation markdown files and index
- .github/workflows/deploy-docs.yml: GitHub Actions workflow for automated deployment
- build-docs.sh: Documentation build script
- serve-docs.sh: Local documentation server script
- logo.png: Documentation site logo

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
YosefAshenafi and others added 14 commits November 14, 2025 09:13
…covery

## Problem
Manual symlinks for every README.md file were not scalable and required
constant maintenance as new apps and libraries were added.

## Solution
Implemented a hook-based approach that dynamically discovers and creates
symlinks at build time, eliminating the need for manual maintenance.

## Key Changes
- Added `.claude/mkdocs_hooks.py` hook that:
  - Runs on every mkdocs build
  - Automatically scans htk/apps/ and htk/lib/ directories
  - Creates symlinks dynamically for all README.md files
  - Symlinks are never committed to git (added to .gitignore)

- Updated `mkdocs.yml`:
  - Enhanced navigation with all 29 Django apps submenu
  - Enhanced navigation with all 44+ library integrations submenu
  - Added hooks configuration to enable dynamic symlink generation

- Enhanced `docs/extra.css`:
  - Header color set to `#0101fe` (bright blue)
  - Disabled scroll bounce effect using `overscroll-behavior: none`
  - Preserved normal scrolling functionality

- Added `MKDOCS_SETUP.md`:
  - Comprehensive documentation on the dynamic setup
  - Instructions for adding new apps/libraries
  - Explanation of why this approach is scalable

- Created `scripts/generate_nav.py`:
  - Utility script for analyzing directory structure
  - Can be used for future automation

## Technical Details
- Hook runs as `on_pre_build` before documentation builds
- Creates temporary symlinks in docs/apps/ and docs/lib/
- Symlinks point directly to source README.md files
- No duplicated documentation content
- Build overhead: < 1 second

## Scalability Benefits
✅ Zero manual maintenance for new apps/libraries
✅ Automatic detection of all README.md files
✅ Never committed to git (cleaner repository)
✅ Works with unlimited number of modules
✅ Easy to understand and maintain

## Testing
- All 73+ documentation pages load successfully
- Zero build warnings
- Navigation includes all 29 apps and 44+ libraries
- Dynamic symlinks created correctly at build time

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
## Changes
- Removed all tracked symlinks from docs/ directory
  - docs/admin.md, docs/api.md, docs/apps.md, etc.
  - These are now dynamically created by mkdocs hooks at build time

- Enhanced .gitignore to prevent future symlink tracking:
  - Added `docs/*.md` to ignore all symlinked markdown files
  - Added `docs/*.png` to ignore symlinked logo
  - Added exception for `docs/extra.css` (kept as static styling)
  - Kept `docs/apps/` and `docs/lib/` in gitignore

## Why
- Symlinks created by the hook should not be tracked in git
- Keeps repository clean and reduces clutter
- Prevents merge conflicts from regenerated symlinks
- Maintains scalability: new docs detected automatically

## Documentation Available
The site now documents 90 primary modules:
- 18 top-level modules (admin, api, cache, models, etc.)
- 28 Django apps (accounts, organizations, stripe, etc.)
- 44 library integrations (slack, openai, stripe_lib, etc.)

Plus 200+ nested READMEs within those modules.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
## Changes
- Moved `extra.css` from `docs/` to root directory
- Updated `mkdocs.yml` to reference `../extra.css`
- Completely removed `docs/` folder from git tracking
- Simplified .gitignore to just ignore `docs/` entirely

## Why
- extra.css is a configuration file, not generated content
- Belongs at root with mkdocs.yml
- docs/ folder is entirely generated at build time by the hook:
  - Hook creates symlinks for all modules
  - mkdocs generates HTML output
  - Should never be committed to git

## Clean Structure
After build, the site has:
```
htk/
├── mkdocs.yml          # Config (committed)
├── extra.css           # Styling (committed)
├── .claude/
│   └── mkdocs_hooks.py # Build hook (committed)
├── docs/               # Generated at build time (ignored)
│   ├── *.md           # Symlinks created by hook
│   ├── apps/          # Symlinks created by hook
│   ├── lib/           # Symlinks created by hook
│   └── site/          # HTML output
└── [source files]
```

## Benefits
✅ Cleaner git repository
✅ Only source files committed
✅ Generated files never tracked
✅ Extra.css in logical location

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
## Changes
- Updated header color from #0101fe to #0000e6 (requested change)
- Updated color variants accordingly:
  - Light variant: #1a1aff
  - Dark variant: #0000b3
- Added site/ folder to .gitignore for HTML build output
- Removed generated site/ folder from repository

## Why
- Header color #0000e6 is the correct specification
- site/ folder contains generated HTML and should not be committed
- Only source files should be in git, not build output

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
…cumentation

## Changes
- Updated `.github/workflows/deploy-docs.yml`:
  - Added `mkdocs-include-markdown-plugin` to dependencies
  - Workflow now compatible with new hook-based build system

- Simplified `build-docs.sh`:
  - Removed manual README copying (replaced by hook system)
  - Now just calls `mkdocs build`
  - Hook handles all symlink generation automatically
  - Added clear comments about hook functionality

## How It Works on Deployment

When changes are pushed to master/main:
1. GitHub Actions triggers the workflow
2. Installs dependencies (including our plugins)
3. Runs build-docs.sh which calls mkdocs build
4. The .claude/mkdocs_hooks.py hook runs automatically
5. Hook creates symlinks for all 90+ modules dynamically
6. MkDocs builds the complete documentation site
7. GitHub Pages deploys the site to gh-pages branch

## Benefits
✅ Automatic on every push
✅ Dynamic discovery of all READMEs
✅ No manual symlink maintenance
✅ Clean, minimal build process
✅ Works on GitHub Actions servers

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Reverts unnecessary documentation expansions and restores the original README content while ensuring all relative links work correctly.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Removes build-docs.sh, serve-docs.sh, extra.css, and MKDOCS_SETUP.md as they are convenience scripts/files not essential for mkdocs configuration.

Only keeping:
- mkdocs.yml for documentation configuration
- .github/workflows/deploy-docs.yml for GitHub Pages deployment
- All README.md files and generated documentation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
The extra.css file is essential for custom styling of the mkdocs documentation site.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Changed the GitHub Actions workflow to call 'mkdocs build' directly instead of relying on build-docs.sh script which was removed.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
## Problem
The mkdocs documentation site was showing 404 errors on all pages because the hook only created symlinks for apps and libs, missing top-level module documentation files (admin, api, cache, etc.). Additionally, excessive debug logging was cluttering the build output.

## Solution
- Enhanced the mkdocs hook to create symlinks for all top-level module directories
- Added symlink generation for index.md (from main README) and apps.md/lib.md overview files
- Removed all debug logging statements for cleaner output
- Updated logo URL from local path to external URL (https://www.hacktoolkit.com/logo.png)

## Changes
- Updated `mkdocs.yml`: Changed logo from `logo.png` to `https://www.hacktoolkit.com/logo.png`
- Enhanced `.claude/mkdocs_hooks.py`:
  - Added symlinks for top-level modules (admin, api, cache, constants, decorators, extensions, forms, middleware, models, utils, validators, test_scaffold, scripts, templatetags)
  - Added index.md symlink from main README.md
  - Added apps.md and lib.md overview symlinks
  - Removed all logging imports and log statements
  - Changed exception handling to silent mode with pass statements

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Remove hardcoded nav configuration and implement filesystem-based navigation generation. The mkdocs hook now dynamically discovers README.md files in the htk directory structure and generates navigation entries on each build.

## Problem
The `mkdocs.yml` contained 100+ lines of hardcoded navigation entries that required manual updates whenever new apps or libraries were added to the codebase. This created maintenance burden and risk of the nav becoming out-of-sync with the actual structure.

## Solution
Refactored the mkdocs hook to dynamically generate the navigation configuration by scanning the filesystem for README.md files. The hook extracts titles from each README's first heading and builds nested navigation for Django Apps and Libraries.

## Changes
- Added `generate_nav_config()` function to dynamically build navigation from filesystem structure
- Added `format_name()` utility to convert directory names to readable titles
- Added `get_title_from_readme()` to extract titles from README first headings
- Modified `on_pre_build()` hook to set `config['nav']` dynamically
- Removed hardcoded `nav` section from `mkdocs.yml` (99 lines)
- Added cleanup logic to remove orphaned directory-level README.md symlinks
- Refactored symlink creation into `create_symlinks()` function

Benefits:
- Nav is now automatically in sync with filesystem structure
- New apps/libraries appear in docs without manual configuration
- Cleaner, more maintainable codebase
- Documentation build remains clean and warning-free

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
YosefAshenafi and others added 3 commits November 14, 2025 16:47
Move the extra.css file to the proper mkdocs static asset location and update references. Remove extra.css from root and exclude_docs.

## Problem
The CSS file was stored at the root with a relative path reference `../extra.css` which was causing 404 errors. Additionally, `static/` was in the `exclude_docs` list which prevented mkdocs from copying static assets.

## Solution
- Created `docs/static/css/mkdocs.css` in the proper mkdocs asset location
- Updated `mkdocs.yml` to reference `static/css/mkdocs.css`
- Removed `static/` from `exclude_docs` so mkdocs copies assets to `site/static/`
- Removed root `extra.css` file

## Changes
- Added `docs/static/css/mkdocs.css` with custom color scheme and animations
- Updated `extra_css` reference in `mkdocs.yml` from `../extra.css` to `static/css/mkdocs.css`
- Removed `static/` from `exclude_docs` in `mkdocs.yml`
- Removed tracked `extra.css` from repository root

## Benefits
✅ CSS file now properly served from `site/static/css/mkdocs.css` with no 404 errors
✅ Cleaner repository structure with assets in docs folder
✅ Standard mkdocs asset organization
✅ CSS loads correctly on all pages

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Remove the mkdocs offline plugin that was adding extra text and UI elements below the footer. Add CSS to hide any remaining announce/skip link elements and ensure proper page layout.

## Problem
The offline plugin and Material theme skip links were rendering text like "main menu" and "settings" below the footer, causing visual clutter.

## Solution
- Removed `offline` plugin from mkdocs.yml
- Added CSS to hide `.md-skip`, `.md-announce`, and announce components
- Added flexbox layout to body to ensure footer stays at bottom
- Added `overflow-x: hidden` to prevent horizontal scrolling

## Changes
- Removed `offline` plugin from `plugins` section in `mkdocs.yml`
- Added CSS to `mkdocs.css`:
  - Hide skip links and announce elements: `.md-skip`, `.md-announce`
  - Proper page layout with flexbox on body and md-container
  - Prevent horizontal overflow

## Benefits
✅ No more "main menu" and "settings" text below footer
✅ Cleaner, more professional appearance
✅ Offline functionality not needed (site deployed to GitHub Pages)
✅ Better page layout structure with flexbox

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Remove the data module from the mkdocs navigation as it only contains minimal documentation (just license info and reference to subdirectories).

## Problem
The data module only has a minimal README with no actual documentation content - just "Collection of various open-source data" and license info. It doesn't provide value in the main navigation.

## Solution
- Removed 'data' from `top_level_modules` list in generate_nav_config()
- Removed 'data' from `top_level_dirs` list in create_symlinks()

## Changes
- Updated `.claude/mkdocs_hooks.py` to exclude data module from navigation and symlink generation

## Result
✅ Data module no longer appears in main navigation menu
✅ Countries subdirectory data still accessible if needed (in site/data/)
✅ Cleaner navigation with only meaningful modules

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@jontsai jontsai merged commit dfa737f into master Nov 14, 2025
5 of 6 checks passed
@jontsai jontsai deleted the gh-pages branch November 14, 2025 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants