Framework
docc-static
A command-line tool for generating static HTML/CSS documentation from Swift packages.
Overview
The docc-static command-line tool generates pure HTML/CSS documentation from Swift packages. The output works locally as file:// URLs and can be hosted on any static web server without requiring JavaScript (on the server or in the browser) for basic navigation.
For programmatic access, see the DocCStatic library. For an integrated SPM workflow, use the GenerateStaticDocumentation plugin.
Installation
Install using Homebrew:
brew tap mipalgu/tap
brew install swift-docc-static
Or build from source:
git clone https://github.com/mipalgu/swift-docc-static.git
cd swift-docc-static
swift build -c release
Quick Start
Generate documentation for a Swift package:
docc-static generate --package-path /path/to/package --output ./docs
Preview the generated documentation:
docc-static preview --output ./docs
Commands
generate
Generate documentation from a Swift package:
docc-static generate [options]
Options:
|
Option |
Description |
|---|---|
|
|
Path to the Swift package (default: |
|
|
Output directory (default: |
|
|
Scratch path for Swift build operations |
|
|
Pre-generated symbol graph directory |
|
|
Specific targets to document (repeatable) |
|
|
Include all dependencies |
|
|
Include specific dependency (repeatable) |
|
|
Exclude specific dependency (repeatable) |
|
|
External docs URL mapping ( |
|
|
Disable client-side search |
|
|
Custom HTML for page footer |
|
|
Enable verbose output |
|
|
Show summary statistics after generation |
Examples:
# Generate with verbose output
docc-static generate -v
# Document specific targets
docc-static generate -t MyLib -t MyOtherLib
# Include dependencies except specific ones
docc-static generate -I -x ExcludedPackage
# Link to external documentation
docc-static generate -e com.apple.documentation=https://developer.apple.com
render
Render static HTML from an existing DocC archive:
docc-static render <archive-path> --output ./docs
preview
Start a local preview server:
docc-static preview --output ./docs --port 8080
Topics
Essentials
Install and use the command-line tool to generate static documentation.
Generate and preview documentation during development.
Deployment
Host your generated documentation on web servers and CDNs.
Automate documentation generation with continuous integration.