Swift-DocC sidebar

I'm excited to announce that the Swift-DocC sidebar has been enabled by default in Swift-DocC-Render with:

The sidebar will only be available for DocC archives produced by the latest version of DocC that includes the necessary index file.

I've updated the ArgumentParser demo with the latest changes: https://ethan-kusters.github.io/swift-argument-parser/documentation/argumentparser/.

If you'd like to try out the sidebar with your own Swift Package, you can do the following:

Testing instructions:

Note that I'm going to use the Swift-DocC Plugin to simplify the instructions here but it's not actually required for this functionality. It just makes testing prerelease versions of the docc CLI a little more user-friendly.

  1. Build the latest version of Swift-DocC:

    git clone https://github.com/apple/swift-docc.git
    cd swift-docc
    swift build
    

  1. Set the DOCC_EXEC environment variable to your locally built copy of docc:
    export DOCC_EXEC=`pwd`/.build/debug/docc
    

  1. Clone the latest pre-built version of Swift-DocC-Render:

    git clone https://github.com/apple/swift-docc-render-artifact.git
    cd swift-docc-render-artifact
    

  1. Set the DOCC_HTML_DIR environment variable to your local copy of Swift-DocC-Render:

    export DOCC_HTML_DIR=`pwd`/dist
    

  1. Adopt the Swift-DocC-Plugin in your package by following the instructions here.

    .package(url: "https://github.com/apple/swift-docc-plugin", from: "1.0.0"),
    

  1. Change directory to your package and run the preview-documentation command for your target:
    cd <path-to-your-package>
    swift package --disable-sandbox preview-documentation --target <name-of-package-target>
    

  1. That's it!

If you encounter any issues while trying things out, a bug report on bugs.swift.org (and soon GitHub Issues) would be really appreciated.

- Ethan

5 Likes