I've extended a Chrome extension that adds color-coded tags to DocC documentation sidebars. Originally created by ktiays for Apple's docs, I've modified it to work with any DocC-generated site.
What it does
Adds color backgrounds to navigation tags (Article, Tutorial, Sample Code, etc.)
Makes it easier to scan and find what you're looking for
Works in both light and dark mode
Now detects and enhances any site using Swift's DocC framework
I love browsing through Point-Free's documentation and other third-party Swift packages, but they all have the same monochrome sidebar. This extension brings the same visual improvements to all DocC sites - whether it's Apple's, yours, or anyone else's.
The extension detects DocC by looking for the webpackChunkswift_docc_render signature, so it automatically works when you visit any DocC documentation.
This is a great extension! I really appreciate you expanding on ktiays' original work to support all DocC-generated sites. The color-coded tags definitely make navigation much cleaner.
I've created a swift-docc-render branch to test this feature natively, so people can enjoy the colored navigation effect directly without needing to install the browser extension:
If documentation is built using a swift-docc-render that includes this code, the colored tags will be there by default - no browser extension needed. This makes the enhancement accessible to everyone viewing the documentation.
Also I was wondering if there are any plans to support specifying custom swift-docc-render artifacts in the SPI config file? Currently, we can use DOCC_HTML_DIR locally, but having the ability to specify an alternative renderer in the SPI configuration would be really valuable for features like this before they land in the official toolchain. cc @finestructure
Would love to hear thoughts from others on this visual enhancement!
Web development isn’t my forte but I believe this would be a security issue if we allowed injection from arbitrary DOCC_HTML_DIRs into the SPI site.
But even if it isn’t, I don’t think we want the look and feel be different on a per package basis. If this is generally accepted as an good improvement we should adopt it either via an official update in docc-render or via a custom version (like yours) that we use by default for all docs going forward.
My preference is strongly the former, just to reduce the amount of customisation we do when generating docs. Each modification we make is something we need to check against when there are issues (and doc generation is one of the most common support requests), so the closer we stay to just the defaults, the easier for us.
Got it. I'll then try to propose it to merge into the official upstream.
But since it is a theme, and everyone have their own preference. So I guess upstream may refuse to accept such patch. Any idea or suggestion on this @marinaaisa