documentation/writing-docs.md
This guide covers generating and updating SkiaSharp API documentation.
SkiaSharp provides two types of documentation: concept docs and API docs.
The concept docs are on the docs branch of this repository and published to:
The API docs are XML reference documentation generated from SkiaSharp assemblies using mdoc. They are published to https://docs.microsoft.com/dotnet/api/skiasharp.
Because the docs are large and contain examples, images, and other assets, they are hosted in a separate repository:
This repository is pulled into the main SkiaSharp repo as a Git submodule at docs/. The XML files live under docs/SkiaSharpAPI/.
A GitHub Actions workflow in mono/SkiaSharp-API-docs regenerates the API docs daily from the latest CI build artifacts. It checks out this repo (for the Cake build scripts) and the docs repo, then runs the doc generation targets:
update-docs.yml (in the docs repo)mono/SkiaSharp-API-docs → "Update API Docs" → "Run workflow"main)dotnet cake --target=update-docs which:
docs-api-diff)mdoc update to regenerate XML docs (docs-update-frameworks)docs-format-docs)mono/SkiaSharp-API-docsOnce the docs PR is merged into mono/SkiaSharp-API-docs, update the submodule pointer in the main SkiaSharp repo:
cd docs
git checkout master
git pull
cd ..
git add docs
git commit -m "Update docs submodule"
dotnet tool restore
cd docs
git checkout -b my-docs-update
cd ..
dotnet cake --target=docs-download-output
This downloads NuGet packages from the SkiaSharp-CI feed. By default it fetches from the main branch. To use a different branch:
dotnet cake --target=docs-download-output --gitBranch=my-feature-branch
dotnet cake --target=update-docs
This generates both the changelogs and the XML API docs in the docs/ directory.
After generating, you can open the XML files in any text editor and add or update documentation. Any members that do not have content will have the placeholder text "To be added."
You can also use the api-docs Copilot skill to write and review XML documentation. Ask Copilot to "fill in missing docs", "document SKCanvas", or "review documentation quality" and it will follow the .NET API documentation guidelines automatically.
As you edit, you can apply formatting and see what docs are still missing by running:
dotnet cake --target=docs-format-docs
This will report a summary of documentation coverage (types and members with missing docs).
Once you are happy with your changes, push them to your fork of mono/SkiaSharp-API-docs and open a PR.
For detailed XML documentation patterns and review criteria, see:
.github/skills/api-docs/references/patterns.md — XML syntax and examples.github/skills/api-docs/references/checklist.md — Review severity criteria| Target | Description |
|---|---|
docs-download-output | Downloads _nugets and _nugetspreview packages from the SkiaSharp-CI Azure Artifacts feed |
docs-api-diff | Compares current NuGets against latest published versions, generates markdown diffs and changelogs |
docs-api-diff-past | Generates historical API diffs across all published versions |
docs-update-frameworks | Extracts assemblies, builds frameworks.xml with monikers, runs mdoc update to generate XML API docs |
docs-format-docs | Cleans XML output, removes duplicates, syncs extension method docs, reports coverage |
update-docs | Runs docs-api-diff → docs-update-frameworks → docs-format-docs in sequence |