Document Organization & Storage
Relevant source files
The following files were used as context for generating this wiki page:
The Document Organization & Storage system in the WHK project is designed as a structured knowledge base for high school science and culture subjects. It utilizes a layered directory approach where raw content is drafted in development folders before being integrated into a categorized production directory (docs/). This system is optimized for static site generation using MkDocs/Pandoc and features a rigorous workflow for content migration and metadata management.
Sources: README.md:46-56, scripts/workflows/supplement-integration-v2.md:8-13
Directory Hierarchy
The project separates content into distinct stages: source/draft content, processed documentation, and system rules. The primary content repository is the docs/ folder, which serves as the source for the static site.
Content Structure
The docs/ directory is organized by academic discipline and meta-information:
| Directory/File | Description |
|---|---|
docs/index.md | Main landing page/introduction. |
docs/home/ | Administrative documentation, including formatting guides and project roadmaps. |
docs/science/ | Core science subjects including Mathematics, Mechanics, Electromagnetism, etc. |
docs/cultural/ | Liberal arts subjects such as Chinese, English, and History. |
docs/blog/ | AI-assisted blog posts and supplementary articles. |
Sources: README.md:58-69, scripts/frontmatter/generate_frontmatter.js:51-53
Development and Staging
Content before finalization resides in the dev/ directory, specifically within dev/supplement/. This acts as a staging area where content is organized as notes before being merged into the appropriate docs/ file.
The diagram above illustrates the flow of information from raw supplementary notes to the structured documentation folders.
Sources: scripts/workflows/supplement-integration-v2.md:8-13, README.md:58-69
Metadata and Frontmatter
Documents in the docs/ hierarchy, particularly within docs/science/, utilize YAML frontmatter for SEO and categorization. This metadata is automatically managed via the generate_frontmatter.js script.
Frontmatter Schema
Every production document typically includes a standardized block of metadata at the beginning of the file.
| Field | Description | Constraints |
|---|---|---|
title | SEO-optimized title | ~20-25 characters |
description | Summary of technical or scientific content | 100-200 characters |
summary | Minimalist abstract for card displays | 50-100 characters |
tags | Multi-dimensional tags (Subject, Core Term, Application) | 15-25 tags |
Sources: scripts/frontmatter/generate_frontmatter.js:143-154, scripts/skills/read/SKILL.md:52-57
Storage Analysis and Processing Tools
The project implements a suite of specialized JavaScript tools located in scripts/skills/read/ to interact with and analyze the stored files without loading entire large datasets into memory.
Analysis Logic
- H1 Scanner (
dir_h1.js): Traverses thedocsdirectory to extract the first level-1 heading from every Markdown file to build a rapid index. - Headings Extractor (
file_headings.js): Identifies the hierarchical structure of a specific file by extracting all lines starting with#. - Pre-limit Viewer (
file_prelimit.js): Reads the first 1000 non-whitespace characters to preview content while skipping YAML frontmatter. - File Splitter (
file_split.js): Segments large documents (over 20,000 characters) into temporary.tmpchunks to facilitate processing within AI context windows.
The flow represents the logic used by the file_prelimit.js tool to provide content previews without frontmatter interference.
Sources: AGENTS.md:14-25, scripts/skills/read/SKILL.md:12-96, scripts/skills/read/file_prelimit.js:25-45
Integration and Synchronization
Content storage is managed through a "Plan-Execute" workflow to ensure the docs/ folder remains consistent with the project's style guides.
- Planning Phase: Analyzing the
dev/supplementdirectory to map draft files to their target destinations indocs/usingdir_h1.js. - Execution Phase: Splitting large source files and merging the content into specific sections of the target Markdown files.
- Validation: Running
review.js lintto ensure that the integrated content adheres to indentation (4 spaces) and punctuation rules.
Sources: scripts/workflows/supplement-integration-v2.md:18-35, REVIEW.md:54-58
Conclusion
Document organization in the WHK project is a strictly controlled process that transitions content from an unorganized dev/ state to a highly structured, metadata-rich docs/ environment. By utilizing a combination of directory-based categorization and automated metadata generation scripts, the system ensures that thousands of technical and scientific notes remain searchable and compliant with the project's rigorous architectural standards.