Qwt Documentation Writing Standards¶
This guide provides standards for writing Qwt documentation, ensuring consistent style, complete content, and easy readability.
The project documentation is organized with MkDocs, using the mkdocs-material theme. During the writing process, Material-related syntax extensions can be used.
Project documentation diagrams should primarily use mermaid.
Document Structure¶
1. Heading Hierarchy¶
1 2 3 4 5 6 7 | |
2. Required Sections¶
Each feature document must include the following sections:
| Section | Required | Description |
|---|---|---|
| Feature Overview | Required | A one-sentence description of the class's purpose and features at the beginning |
| Key Features | Required | List core features, marked with ✅ |
| Usage | Required | Detailed usage steps and code examples |
| Notes | Recommended | Use !!! format to highlight important information |
| References | Optional | Related documentation and example path links |
Content Writing Principles¶
1. Text Description Requirements¶
- Every code block must be preceded and followed by text: Explain the code's purpose, key steps, and output
- Avoid pure code dumps: Code should not dominate the document; text descriptions should account for at least 60%
- Progressive guidance: Organize content in a logical order of "what → why → how"
2. Feature Introduction Format¶
Use feature list format, with each feature prefixed by a ✅ mark:
1 2 3 4 | |
3. Code Example Standards¶
Code examples must include:
- Comment descriptions: Key lines must have comments
- Complete and runnable: Example code should run directly (with necessary header includes)
- Effect description: Describe the running effect after the code, accompanied by screenshots or diagrams
1 2 3 4 5 6 7 8 9 10 | |
4. Concept Explanation Requirements¶
For complex concepts, use the following methods to aid explanation:
- Mermaid UML diagrams: Show class relationships and inheritance hierarchies
- Mermaid flowcharts: Show workflows
- ASCII art diagrams: Show structural diagrams
- Screenshots: Actual effect screenshots
Example (class relationship diagram):
classDiagram
class QwtPlotSeriesItem {
+drawSeries()
+boundingRect()
}
class QwtSeriesStore~T~ {
+setData()
+sample()
}
class QwtPlotBoxChart {
+setBoxStyle()
+setOrientation()
}
QwtPlotSeriesItem <|-- QwtPlotBoxChart
QwtSeriesStore <|-- QwtPlotBoxChart
5. Notes Format¶
Use Markdown extension syntax to highlight important information:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | |
6. Property/Method Description Format¶
Use table format to display core properties and methods:
1 2 3 4 5 6 | |
Diagram Usage Standards¶
1. Mermaid Class Diagrams¶
Used to show class inheritance and composition relationships:
classDiagram
class BaseClass {
+virtual method()
}
class DerivedClass {
+override method()
}
BaseClass <|-- DerivedClass
2. Mermaid Flowcharts¶
Used to show usage workflows and processes:
flowchart TD
A[Create Object] --> B[Set Data]
B --> C[Configure Style]
C --> D[Attach to Plot]
D --> E[Refresh Display]
3. Structural Diagrams¶
Use text or ASCII art to draw structural diagrams:
1 2 3 4 5 | |
4. Effect Screenshots¶
Actual runtime screenshots should be placed in the docs/assets/ directory:
1 | |
For effect screenshots, precede them with a text description referencing the relevant example, for instance:
1 2 3 | |
Document Style Consistency¶
1. Language Style¶
- Use English as the primary language; technical terms can remain in their original form
- Avoid colloquial expressions; use formal written language
- Reduce passive voice; use active voice: "You can set..." rather than "It can be set..."
2. Terminology Standards¶
| English Term | Description |
|---|---|
| Box-and-Whisker Plot | Statistical chart |
| Quartile | Q1, Q2, Q3 |
| Outlier | Data points outside the normal range |
| Whisker | Extension lines of a box chart |
3. Code Style¶
- Use full class paths:
QwtPlotBoxChart - Use code format for method names:
setBoxStyle() - Use code format for property names:
boxStyle - Use full paths for enum values:
QwtPlotBoxChart::Rect
Writing Workflow Suggestions¶
- Gather information: Read class header files, example code, and related documentation
- Determine structure: Plan the document framework according to the required sections
- Write content:
- Start with the feature overview and feature list
- Then write the usage section, with text descriptions accompanying each code block
- Add notes and references
- Add diagrams: Draw class diagrams, flowcharts, and structural diagrams
- Review and revise: Check code runnability, text fluency, and format consistency
Document Template¶
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | |
Usage¶
[If there is a corresponding example, include this content] The xxx example is located in: examples/xxx. Screenshot below:
1 | |
1. Basic Usage¶
[Text description of purpose and scenarios]
1 | |
[Effect description]
2. Advanced Configuration¶
[Text description of configuration options]
| Method | Description |
|---|---|
| Method 1 | Description |
| Method 2 | Description |
1 | |
Note
Important reminder
This standard applies to writing all Qwt English usage guide documentation.