Framework
DocCStatic Library
Generate static HTML/CSS documentation from Swift packages.
Overview
swift-docc-static generates pure HTML/CSS documentation from Swift packages, combining the symbol graph processing of Swift-DocC with a static output approach. The generated documentation works locally as file:// URLs and can be hosted on any web server without requiring JavaScript for basic navigation.
This package provides:
-
The DocCStatic Swift library for programmatic use (documented here)
-
The docc-static command-line tool (see the docc-static module)
-
The SPM plugin for Swift Package Manager integration (see the GenerateStaticDocumentation module)
Key Features
-
Pure HTML/CSS output: JavaScript is only used for optional client-side search
-
Multi-target support: Document all targets and products in a package
-
Cross-package linking: Relative links work correctly for local file:// URLs
-
DocC compatibility: Supports symbols, articles, and tutorials
-
Customisable styling: Match Apple’s DocC appearance or use your own theme
Quick Start
Create a generator with your configuration, then call generate():
let configuration = Configuration(
packageDirectory: URL(fileURLWithPath: "/path/to/package"),
outputDirectory: URL(fileURLWithPath: "/path/to/docs"),
includeSearch: true
)
let generator = StaticDocumentationGenerator(configuration: configuration)
let result = try await generator.generate()
print("Generated \(result.generatedPages) pages")
Topics
Essentials
Use the DocCStatic library to generate static documentation programmatically.
Guides
Configure DocCStatic for your documentation needs.
Understand how DocCStatic handles links between packages.
Customise the appearance of your documentation.
Library API
Configure DocCStatic for your documentation needs.
The main orchestrator for generating static HTML documentation.
The result of a documentation generation operation.
Errors that can occur during documentation generation.
Rendering
Builds complete HTML pages from render nodes.
Renders DocC render content to HTML.
Builds a combined index page listing all documented modules.
A consumer that writes documentation to static HTML files.
Search
Builds a search index for client-side documentation search.
Supporting Types
Policy for including dependency documentation in the generated output.
Configuration for the documentation theme.
A warning generated during documentation generation.
A location in source code.
Structures
Post-processes generated HTML to resolve doc:// URLs into proper links.
Represents the navigation index for documentation.
A node in the navigation tree.
Builds the navigation sidebar HTML from a navigation index.
A simple Swift syntax highlighter for static HTML output.
A symbol kind for documentation display, wrapping DocumentationNode.Kind.
Enumerations
The type of a navigation node.