Getting Started & Local Setup
Relevant source files
The following files were used as context for generating this wiki page:
RainPPR's WHK Blog is a systematic knowledge base focused on high school science subjects (Mathematics, Physics, Chemistry, Biology). It utilizes a sophisticated technical stack transitioning from MkDocs/Properdocs to mkpandocs (Pandoc) to support server-side KaTeX rendering and advanced Markdown features. The project is designed for both online reading and automated PDF generation via GitHub Actions.
Sources: README.md:1-25, README.md:27-28
The repository integrates a complex CI/CD pipeline and an AI-assisted workflow for content creation and quality assurance. Developers can choose between a containerized Docker setup or a local environment utilizing uv for Python dependency management and npm for Node.js scripts.
Sources: README.md:113-146, AGENTS.md:1-10
Prerequisites & Environment Setup
The project requires specific runtime environments for its Python-based site generation and Node.js-based utility scripts.
Core Requirements
| Requirement | Recommended Version | Purpose |
|---|---|---|
| Python | 3.14+ | Core site generation and logic |
| uv | Latest | Python package and project management |
| Node.js | 20+ | Running AI skills, frontmatter generation, and build scripts |
| Docker | Latest | Recommended for consistent local preview environments |
Sources: README.md:95-97, pyproject.toml:6
Local Dependency Installation
If not using Docker, dependencies must be installed across multiple environments:
# Install Python dependencies using uv
uv sync --locked
# Install core build dependencies
npm ci
# Install specific script dependencies
cd scripts/frontmatter && npm ci
cd scripts/review && npm ci
Sources: README.md:113-125
Local Development Workflows
Docker-based Workflow (Recommended)
The project provides a Makefile to simplify operations using a custom Docker image (ghcr.io/raineblog/mkdocs-docker).
The diagram above illustrates the standard lifecycle of setting up and building the project using Docker.
Sources: README.md:100-111, README.md:128-137
Manual Local Execution
Users opting for a local installation use uv to execute the generation scripts directly.
| Action | Command |
|---|---|
| Local Preview | uv run scripts/generate.py --serve |
| Static Build | uv run scripts/generate.py --build --site_url=[URL] |
| Linting | make lint |
Sources: README.md:121-137
AI-Assisted Content Workflow
The project utilizes specialized AI agents to maintain high-quality documentation standards. These are categorized into "read" and "review" skills.
Reading and Analysis
The read skill set allows for rapid analysis of the documentation structure without manual browsing.
- dir_h1.js: Scans for the primary title of all Markdown files.
- file_headings.js: Extracts the hierarchical structure of a specific file.
- file_prelimit.js: Previews the first 1000 characters of a file.
- file_split.js: Splits large documents into 20,000 character chunks for LLM context management.
Sources: AGENTS.md:14-36, scripts/skills/read/SKILL.md:10-85
Content Integration & Review
A specific workflow exists for integrating content from dev/supplement into the main docs directory.
This sequence shows the integration process from supplemental files to the verified documentation set.
Sources: scripts/workflows/supplement-integration-v2.md:37-140, REVIEW.md:10-25
Build & Optimization System
The project uses a custom build.ts script (executed via Bun) to perform in-place optimization of the generated site.
Post-Processing Pipeline
The build script performs the following optimizations:
- HTML: PostHTML optimization including deduplication of meta tags, structural data (LD+JSON), and reordering of
<head>elements for performance. - CSS: PostCSS processing with Autoprefixer and cssnano for minification.
- JS: Terser-based deep compression with sourcemap generation.
- Minification: Full HTML minification via
html-minifier-terser.
Sources: build.ts:10-40, build.ts:400-470
Key Build Parameters
| Parameter | Default Value | Description |
|---|---|---|
CONCURRENCY | 16 | Number of files processed simultaneously |
dir | site | Target directory for in-place optimization |
BROWSERSLIST | Chrome/Firefox/Safari/Edge (last 2 versions) | Target browser compatibility for CSS |
Sources: build.ts:47-65
Summary
Local setup for the WHK Blog requires a hybrid environment of Python and Node.js. By utilizing the provided Docker environment or the uv package manager, developers can maintain a consistent build environment. The project emphasizes a rigorous content pipeline where AI tools handle structural analysis and style enforcement, ensuring that all science notes adhere to a unified formatting standard before being processed through the custom optimization build script.
Sources: README.md:225-230, scripts/workflows/supplement-integration-v2.md:200-215