SARibbon Documentation Writing Guide¶
This guide defines the writing standards for SARibbon project documentation, ensuring consistent style, complete content, and clear presentation.
Project documentation is organized with mkdocs using the mkdocs-material theme. Diagrams should prefer mermaid syntax.
Documentation Directory Structure¶
The project uses folder-based i18n (handled by the mkdocs-static-i18n plugin), with each language in its own directory:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | |
Important: Do NOT place .md files in the docs/ root directory
In docs_structure: folder mode, root-level .md files are automatically assigned as default-language files by the plugin, causing conflicts with same-name files inside language folders. All documentation content must reside under the corresponding language folder (zh/ or en/).
When writing English documentation, place files under docs/en/ in the corresponding path. Chinese documentation goes under docs/zh/. Both should maintain structural parity.
MkDocs Build Commands¶
Preview documentation locally:
1 | |
Build static site to site/ directory:
1 | |
After building, access site/en/index.html (English) or site/zh/index.html (Chinese default).
Navigation is configured in the root mkdocs.yml, with separate nav: sections for zh/ and en/. After adding new documents, update both language navigation sections.
Documentation Structure Standards¶
1. Heading Levels¶
1 2 3 4 5 6 7 8 9 | |
2. Required Sections¶
Every feature document should include the following sections:
| Section | Required? | Description |
|---|---|---|
| Feature overview | Required | One-sentence description of the module's purpose and characteristics |
| Main features | Required | List core features with ✅ markers |
| Usage | Required | Detailed steps and code examples |
| API reference | Recommended | Tables of core classes, methods, and properties |
| Notes | Recommended | Use !!! syntax to mark important information |
| References | Optional | Links to related docs and example paths |
Writing Principles¶
1. Text Description Requirements¶
- Every code block must have text before and after: Explain the code's purpose, key steps, and output
- Avoid pure code dumps: Text descriptions should comprise at least 60% of the document
- Progressive guidance: Organize in "what → why → how" logical order
2. Feature Introduction Format¶
Use feature lists with ✅ markers:
1 2 3 4 | |
3. Code Example Standards¶
Code examples must include:
- Comments: Key lines must have explanatory comments
- Runnable: Example code should compile and run directly
- Effect description: Explain the result after the code
1 2 | |
4. Concept Explanation Requirements¶
For complex concepts, use visual aids:
- mermaid class diagrams: Show class relationships and inheritance
- mermaid flowcharts: Show workflows and data flow
- mermaid sequence diagrams: Show interactions and signal-slot connections
- Screenshots: Actual runtime screenshots
5. Notes Format¶
Use mkdocs-material extended syntax for important information:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | |
6. Property/Method Description Format¶
Use tables to display core properties and methods:
1 2 3 4 5 6 7 8 9 10 11 | |
Diagram Standards¶
1. mermaid Class Diagrams¶
Use for class inheritance and composition relationships:
classDiagram
class DAAbstractNode {
+execute() bool
+getNodeName() QString
}
class DAWorkflowNode {
-m_workflow: DAWorkflow*
+setWorkflow(workflow)
+execute() bool
}
DAAbstractNode <|-- DAWorkflowNode
Class diagrams are critical — they give readers a clear picture of the class structure.
2. mermaid Flowcharts¶
Use for usage flows and workflows:
flowchart TD
A[Create workflow] --> B[Add nodes]
B --> C[Connect nodes]
C --> D[Configure parameters]
D --> E[Execute workflow]
E --> F[View results]
3. mermaid Sequence Diagrams¶
Use for inter-module interactions and signal-slot connections:
sequenceDiagram
participant User
participant WorkflowScene
participant NodeItem
participant LinkItem
User->>WorkflowScene: Drag in node
WorkflowScene->>NodeItem: Create node
User->>NodeItem: Drag connection
NodeItem->>LinkItem: Create connection
LinkItem->>WorkflowScene: Connection complete signal
4. Screenshots¶
Place runtime screenshots in the docs/assets/ directory:
1 | |
Include the example location before screenshots:
1 2 3 | |
mkdocs-material Syntax¶
1. Admonition Format¶
1 2 | |
Supported types:
- note - Notes
- info - Information
- tip - Tips
- warning - Warnings
- danger - Danger
- bug - Known issues
- example - Examples
- quote - Quotes
2. Code Highlighting¶
1 2 | |
1 | |
1 | |
1 2 3 4 5 6 | |
4. Task Lists¶
1 2 | |
2. Qt Signal/Slot Description Standards¶
Use the following format when describing signals and slots:
1 2 3 4 5 6 7 8 9 10 11 12 | |
3. CMake Configuration Example Format¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | |
4. Version Compatibility Note Format¶
1 2 3 4 5 6 7 | |
Version compatibility note box:
1 2 3 4 5 | |
Writing Workflow Suggestions¶
- Gather information: Read class header files, source code, example code, and related docs
- Plan structure: Outline document framework based on required sections
- Write content:
- Start with feature overview and feature lists
- Then write usage methods, with text explanations for each code block
- Add API reference tables
- Include notes and references
- Add diagrams: Draw class diagrams, flowcharts, and sequence diagrams
- Review and revise: Check code runability, text fluency, and format consistency
Development Guide References¶
SARibbon development guide documents are located in en/dev-guide/ and zh/dev-guide/. When writing documentation, refer to:
| Document | Path | Content |
|---|---|---|
| Coding Standards | dev-guide/coding-standards.md |
Naming conventions, Doxygen comments, Git commit format |
| PIMPL Development Guide | dev-guide/pimpl-dev-guide.md |
Complete PIMPL macro usage, PrivateData definition |
| Qt Integration Guide | dev-guide/qt-integration.md |
Q_PROPERTY, signals/slots, Qt macro conventions |
Chinese and English dev-guide sections should maintain consistent code examples and standard requirements, with only explanatory text translated.
This guide applies to all SARibbon project documentation writing.