Introducing Unidoc Preview: compile, validate, and browse rendered docs on your local machine!

As some may already be aware, Swift Unidoc is a documentation engine that supports rendering documentation for a package and its dependencies, with symbol links that cross module and even package boundaries. This release introduces the unidoc preview and unidoc local tools, which enable compiling and browsing rendered documentation on your local machine.

What’s the update for?

Although Unidoc has existed for a long time now, effectively writing documentation that takes full advantage of its feature set has historically been hampered by several obstacles:

  • Cross-package link resolution occurs at link time, on the server side, which prevented the compiler from diagnosing broken cross-package links.
  • Because cross-package links appear syntactically identical to package-internal links, this prevented the compiler from effectively diagnosing broken links at compile time at all.
  • Because it is difficult (if not impossible) to model the entire Swift package ecosystem locally, in practice, iterating with Unidoc required interacting with the centralized Swiftinit database.
  • This also precluded using Unidoc as a CI validation step, as the CI pipeline would have to manage a build lifecycle on Swiftinit, which is very logistically complex.

Validate your links locally!

Unidoc 0.19 completely overhauls Unidoc’s compilation model such that all link resolution now takes place at compile time, on the client, without having to interact with Swiftinit at all. This allows you to iterate on your documentation locally with the confidence that your documentation is valid before even committing it in Git, or pushing it to GitHub.

Prebuilt binaries now available!

On select platforms (x86_64 Ubuntu 24.04 and aarch64 macOS), we now provide pre-built toolchains that can be installed without compiling Unidoc from source. The downloadable archives also include a copy of the web assets needed to browse rendered documentation locally.

Get started now!

You can get started with local documentation right now by following the Unidoc Quickstart guide. Setting up Unidoc for the first time has also become much easier, as the unidoc tool now provides a unidoc init subcommand that can automatically configure and initialize a local deployment on Linux and macOS.

13 Likes