Contribution & Style Guide
Relevant source files
The following files were used as context for generating this wiki page:
The Contribution & Style Guide for the RainPPR WHK project outlines the standards and workflows required to maintain the integrity and consistency of the learning notes repository. This guide ensures that all content, whether human-authored or AI-assisted, adheres to specific typographical, structural, and technical requirements.
The scope of this guide covers general document typography, the use of specialized Markdown extensions (such as KaTeX and chemical formulas), and the specific workflows for content integration and automated review.
Document Typography and Formatting
Maintaining a consistent visual style is critical for the readability of scientific and mathematical notes. The project enforces strict rules regarding spacing, punctuation, and structure.
General Rules
- Spacing: A space must be added between Chinese and English characters, and between Chinese characters and numbers.
- Punctuation: Use full-width Chinese punctuation marks for Chinese text and half-width characters for numbers.
- Indentation: All indentations must use exactly 4 spaces; the use of Tab characters is strictly prohibited.
- Hierarchy: Each document must have exactly one Level 1 Heading (
#). The Table of Contents (TOC) should not exceed Level 3 Headings.
Sources: README.md:162-167, REVIEW.md:58-66
Structural Spacing
To ensure the Markdown parser renders elements correctly, specific empty lines are required:
- Formulas must be separated from surrounding text by empty lines.
- List items must have empty lines between them.
- Admonition blocks should have empty lines above and below them.
Sources: REVIEW.md:62-64, AGENTS.md:120-122
Scientific and Mathematical Notation
The project uses enhanced Markdown to support scientific documentation, specifically utilizing KaTeX for mathematics and mhchem for chemistry.
Mathematical Formulas
Formulas are rendered using KaTeX. Inline formulas use $ ... $ and block formulas use $$ ... $$. Authors should avoid using Chinese characters inside mathematical formulas where possible.
Sources: README.md:154, REVIEW.md:67
Chemical and Physical Units
- Chemical Equations: Written using the
\ce{...}command, e.g.,$\ce{2H2 + O2 -> 2H2O}$. - Physical Units: Written using the
\pu{...}command, e.g.,$\pu{1kg}$.
Sources: README.md:155-156
Content Blocks and Admonitions
The project transitioned from older syntax (like /// note) to a standardized Markdown admonition syntax using code blocks with attributes.
Admonition Syntax
Admonitions are defined using a code block with the {admonition="type" title="Title"} attribute.
| Attribute | Required | Description |
|---|---|---|
admonition | Yes | Defines the block type (e.g., note, warning, tip, details). |
title | No | The heading displayed on the block. Supports Markdown (bold, formulas). |
Sources: AGENTS.md:88-103
Foldable Blocks (Details)
The details type creates a collapsible section that is hidden by default.
```md {admonition="details" title="Click to expand"}
Hidden content here.
Sources: [AGENTS.md:110-115](https://github.com/raineblog/whk/blob/HEAD/AGENTS.md#L110-L115)
## AI-Assisted Review Workflow
The project utilizes a dedicated suite of tools located in `scripts/review/` to automate the enforcement of style guidelines.
### Review Process Flow
The following diagram illustrates the standard procedure for reviewing a document.
The review process begins with an automated scan, followed by manual corrections and a final deep-read to ensure technical accuracy.
Sources: REVIEW.md:10-21, scripts/review/SKILL.md:8-16
Key Review Tools
| Tool Command | Purpose |
|---|---|
node scripts/review/review.js lint -- --file <path> | Checks for typography and formatting errors; outputs to a .log file. |
node scripts/review/review.js diff | Shows changes in pending files and identifies potential layout issues. |
Sources: REVIEW.md:23-30, AGENTS.md:73-82
Supplement Integration Workflow
The dev/supplement directory contains raw notes that must be integrated into the main docs structure. This follows a two-phase "Plan and Execute" model.
Integration Workflow Diagram
This flow ensures that supplemental content is analyzed and planned before any modifications are made to the primary documentation.
Sources: scripts/workflows/supplement-integration-v2.md:18-30
Document Analysis Tools
For effective integration, the project provides tools to inspect document structures without loading full file contents:
dir_h1.js: Scans H1 titles across the directory.file_headings.js: Extracts all headings with line numbers.file_prelimit.js: Previews the first 1000 characters (excluding frontmatter).file_split.js: Splits large files (>20,000 characters) for easier processing.
Sources: scripts/skills/read/SKILL.md:10-85, AGENTS.md:52-71
Conclusion
Adherence to this Contribution & Style Guide is mandatory for all contributors. By combining strict typographical rules with automated linting tools and structured integration workflows, the RainPPR WHK project maintains a high-quality, professional knowledge base suitable for scientific study and review.