Article
Getting Started with docc-static
Install and use the command-line tool to generate static documentation.
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 for basic navigation.
Installation
Using Homebrew (Recommended)
Install using https://brew.sh:
brew tap mipalgu/tap
brew install swift-docc-static
To upgrade to the latest version:
brew upgrade swift-docc-static
Building from Source
Clone the repository and build:
git clone https://github.com/mipalgu/swift-docc-static.git
cd swift-docc-static
swift build -c release
The executable is located at .build/release/docc-static.
Verifying Installation
Check that docc-static is installed correctly:
docc-static --version
Your First Documentation
Generate documentation for a Swift package:
cd /path/to/your/package
docc-static generate --output ./docs
Open the generated documentation:
open ./docs/index.html
Basic Commands
Generate Documentation
docc-static generate --package-path . --output ./docs
Preview with Local Server
docc-static preview --output ./docs --port 8080
Then open http://localhost:8080 in your browser.
Render from Existing Archive
If you have a pre-built DocC archive:
docc-static render /path/to/MyLibrary.doccarchive --output ./docs
Common Options
|
Option |
Description |
|---|---|
|
|
Path to the Swift package (default: current directory) |
|
|
Output directory for generated documentation |
|
|
Document specific targets only (can be repeated) |
|
|
Show detailled progress information |
|
|
Disable client-side search functionality |
Next Steps
See Also
Related Documentation
A command-line tool for generating static HTML/CSS documentation from Swift packages.
Essentials
Generate and preview documentation during development.