Source: CONTRIBUTING.md - API Documentation Requirements
- All public APIs MUST have XML documentation:
-
<summary>tag - Clear, concise description- Use proper English and grammar
- Clear, concise, complete
- Use imperative mood ("Gets the value" not "Get the value")
- Use infinitive-of-purpose + imperative pattern for instructional sentences
-
<see cref=""/>for cross-references- Link to related types, methods, properties
- Example:
<see cref="View.Draw"/>or<see cref="Application"/>
-
<remarks>for context- Add only if obviously essential to do so
- Add important notes, warnings, or additional context
- Explain non-obvious behavior
-
<example>for non-obvious usage- Include code examples ONLY when usage isn't immediately clear
- Use working, compilable code snippets that strictly adhear to the coding/syntax style
-
Complex topics →
docfx/docs/*.mdfiles- For architecture concepts, patterns, or deep dives
- Link from XML docs to conceptual docs
// ✅ CORRECT
/// <summary>Gets or sets the width of the view.</summary>
// ❌ WRONG
/// <summary>Get or set the width of the view.</summary>// ✅ CORRECT
/// <summary>
/// Draws the view. See <see cref="OnDrawContent"/> for customizing the drawing behavior.
/// </summary>
// ❌ WRONG
/// <summary>Draws the view. Override OnDrawContent to customize.</summary>/// <summary>
/// Creates a new <see cref="Dialog"/> with the specified buttons.
/// </summary>
/// <example>
/// <code>
/// Dialog dialog = new () {
/// Title = "Confirm",
/// Buttons = [new Button ("OK"), new Button ("Cancel")]
/// };
/// Application.Run (dialog);
/// </code>
/// </example>Create a new file in docfx/docs/ when:
- Explaining architecture concepts (e.g.,
application.md,layout.md) - Documenting patterns (e.g.,
cancellable-work-pattern.md) - Providing tutorials or guides
- Content is too long for XML documentation
Link from XML docs to conceptual docs:
/// <summary>
/// Manages the application lifecycle. See the
/// <a href="../docs/application.md">Application Deep Dive</a> for details.
/// </summary>Code Style Tenet #5: Documentation is the specification.
- API documentation defines the contract
- Implementation must match documentation
- When docs and code conflict, fix the code or update the docs
- Keep documentation synchronized with code changes