Skip to content

[2/x] Migrate to DocC for API reference docs#257

Merged
andrewchang-bird merged 20 commits intomasterfrom
dev/andrewchang-bird/docc
Jan 7, 2022
Merged

[2/x] Migrate to DocC for API reference docs#257
andrewchang-bird merged 20 commits intomasterfrom
dev/andrewchang-bird/docc

Conversation

@andrewchang-bird
Copy link
Copy Markdown
Contributor

@andrewchang-bird andrewchang-bird commented Jan 7, 2022

Stack:
📚 #259 [4/x] Bump versions to 0.19.0
📚 #258 [3/x] Codemod Xcode-generated file header comments
📚 #257 ← [2/x] Migrate to DocC for API reference docs
📚 #256 [1/x] Clean up automation pipeline

Overview

We currently use Swift Doc to generate the API reference documentation site, which was deprecated after Apple announced their fancy documentation generator at WWDC 2021 called DocC. In addition to producing great looking content pages, DocC supports arbitrary markdown-formatted articles, interactive tutorials, and works well with SwiftPM packages.

DocC’s feature set makes it easy to consolidate our existing documentation, which is scattered across the README, GitHub wiki, and API reference site. There are several benefits as well, including searchability (Google doesn’t index GitHub wiki pages) and the ability to decouple the README contents from releases.

Path Rewriting

The goal is to host the documentation site on a dedicated vanity domain for searchability and memorability. Unfortunately, DocC doesn’t support serving documentation from the root of the site and instead expects /documentation/mockingbird for articles and /tutorials/mockingbird for tutorials. Since we’ll only ever show documentation for Mockingbird on the site, it doesn’t make sense to include “mockingbird” in the path.

The mainline versions of Swift-DocC and Swift-DocC-Render support generating a documentation archive with a custom base path for static hosting compatibility, but this is strictly additive, e.g. /foo/bar/documentation/mockingbird (see: swiftlang/swift-docc-render#24, swiftlang/swift-docc#44).

To get the desired page paths, I’ve modified the renderer to rewrite URLs in the JSON data to the root. Currently the rewrites are hardcoded to minimize the number of changes since they are applied as a series of patches.

Syntax Highlighting

Swift-DocC-Renderer uses a lightly customized version of highlight.js for syntax highlighting code blocks which differs a bit from GitHub. I’ve patched the highlighting to make the Mockingbird testing API more readable and fix some minor issues (SR-15681).

Screen Shot 2022-01-07 at 3 59 23 AM

Test Plan

Documentation archives are built as part of the release GitHub workflow and pulled by the documentation site here: https://mockingbirdswift.com/

Screen Shot 2022-01-07 at 3 58 56 AM

Copy link
Copy Markdown
Contributor

@ryanmeisters ryanmeisters left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rad

Base automatically changed from dev/andrewchang-bird/cleanup-release-automation to master January 7, 2022 23:04
@andrewchang-bird andrewchang-bird force-pushed the dev/andrewchang-bird/docc branch from 0694871 to 144299b Compare January 7, 2022 23:09
@andrewchang-bird andrewchang-bird merged commit b491852 into master Jan 7, 2022
@andrewchang-bird andrewchang-bird deleted the dev/andrewchang-bird/docc branch January 7, 2022 23:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants