Skip to content

Instantly share code, notes, and snippets.

@jpsim
Last active January 18, 2018 11:23
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpsim/3e8b45f481eff17e6f6d7afbcd74e81b to your computer and use it in GitHub Desktop.
Save jpsim/3e8b45f481eff17e6f6d7afbcd74e81b to your computer and use it in GitHub Desktop.
Generate Swift docs on Linux with Jazzy and SourceKitten

Here are Commandant's docs built on Linux with Jazzy and SourceKitten: https://static.realm.io/jazzy_demo/Commandant

The rough steps are:

  1. Have libsourcekitdInProc.so and Swift 3 available.
  2. Install the jazzy ruby gem.
  3. Build SourceKitten.
  4. Build Swift Package Manager module.
  5. Generate JSON docs for SwiftPM module using SourceKitten.
  6. Generate HTML docs using jazzy and JSON from step 5.
$ docker run -it norionomura/sourcekit:301 bash
> $ apt-get update && apt-get install -y git ruby2.0 ruby2.0-dev make gcc libsqlite3-dev
> $ gem2.0 install jazzy
> $ git clone https://github.com/jpsim/SourceKitten.git
> $ cd SourceKitten
> $ swift build
> $ .build/debug/sourcekitten doc --spm-module Commandant > commandant.json
> $ jazzy -s commandant.json --readme Packages/Commandant-0.11.3/README.md --author Carthage --github_url https://github.com/Carthage/Commandant --github-file-prefix https://github.com/Carthage/Commandant/tree/0.11.3 --module-version 0.11.3 --module Commandant --root-url https://static.realm.io/jazzy_demo/Commandant/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment