Documentation System
This directory contains the automated documentation generation system for Helix Toolkit using DocFX.
Overview
The documentation system automatically generates:
- API Documentation: Extracted from XML documentation comments in C# source code
- Articles: Conceptual documentation and guides (stored in
articles/) - Static Site: A browseable website with search functionality
Building Documentation Locally
Prerequisites
- .NET SDK 6.0 or later
- Git (for cloning the repository)
Quick Start
On Windows
cd Source
build-doc.cmd
On Linux/macOS
cd Source
./build-doc.sh
The documentation will be built and served locally at http://localhost:8080. Press Ctrl+C to stop the server.
Building Without Serving
To build the documentation without starting the local server (useful in CI environments):
Windows
set CI=True
build-doc.cmd
Linux/macOS
CI=true ./build-doc.sh
The generated documentation will be in Documentation/_site/.
Automated Documentation Generation
GitHub Actions Workflow
Documentation is automatically built and deployed via GitHub Actions:
- On Pull Requests: Documentation is built to verify it compiles correctly
- On Push to main/develop: Documentation is built and deployed to GitHub Pages
Viewing Published Documentation
Once deployed, the documentation is available at:
- GitHub Pages:
https://helix-toolkit.github.io/helix-toolkit/
Documentation Structure
Documentation/
├── api/ # Auto-generated API documentation
├── articles/ # Hand-written articles and guides
│ ├── intro.md
│ └── toc.yml
├── images/ # Images used in documentation
├── docfx.json # DocFX configuration
├── index.md # Documentation homepage
└── toc.yml # Top-level table of contents
Writing Documentation
API Documentation
Add XML documentation comments to your C# code:
/// <summary>
/// Represents a 3D model in the scene.
/// </summary>
/// <remarks>
/// This class provides functionality for loading and rendering 3D models.
/// </remarks>
public class Model3D
{
/// <summary>
/// Gets or sets the position of the model in 3D space.
/// </summary>
/// <value>A Vector3 representing the position.</value>
public Vector3 Position { get; set; }
/// <summary>
/// Loads a 3D model from the specified file.
/// </summary>
/// <param name="filename">The path to the model file.</param>
/// <returns>True if the model was loaded successfully; otherwise, false.</returns>
/// <exception cref="FileNotFoundException">Thrown when the file does not exist.</exception>
public bool Load(string filename)
{
// Implementation
}
}
Adding Articles
- Create a new
.mdfile in thearticles/directory - Add the article to
articles/toc.yml:
- name: Getting Started
href: getting-started.md
- name: Your New Article
href: your-new-article.md
Markdown Features
DocFX supports:
- Standard Markdown syntax
- Code blocks with syntax highlighting
- Cross-references to API documentation using
@ApiNamespace.ClassName - Alerts:
> [!NOTE],> [!WARNING],> [!TIP] - Tables, images, and more
Example:
# My Article
This article explains how to use @HelixToolkit.Wpf.HelixViewport3D.
> [!TIP]
> Make sure to initialize the viewport before adding models.
## Code Example
'''csharp
var viewport = new HelixViewport3D();
viewport.Camera = new PerspectiveCamera();
'''
Configuration
The documentation system is configured in docfx.json. Key settings:
- metadata: Specifies which projects to include in API documentation
- build.content: Defines which content files to include
- build.template: Specifies the documentation theme (default + modern)
- build.globalMetadata: Site-wide settings like title, footer, etc.
Troubleshooting
Build Errors
If the documentation build fails:
- Check XML Documentation: Ensure your project files have
<GenerateDocumentationFile>true</GenerateDocumentationFile> - Restore NuGet Packages: Run
dotnet restorein theSource/directory - Clear DocFX Cache: Delete
Documentation/_site/and rebuild
Missing API Documentation
If some classes/methods are missing from the documentation:
- Ensure they are
publicorprotected(private members are not documented by default) - Check that the project is included in
docfx.jsonundermetadata.src.files - Verify XML comments exist for the member
Links Not Working
- Use relative paths for internal links:
[Link](../api/Namespace.Class.yml) - Use
@for API cross-references:@Namespace.ClassName