Introduction
For this year's holiday project, I worked on improving Swift support in Highlight.js.
Highlight.js is a popular framework for syntax highlighting in websites. I often rely on it because it's simple to integrate into a writing/publishing setup. However, its Swift support was quite basic and I encountered many issues with it, so I ended up rewriting and expanding it significantly.
Some of the areas I worked on are:
- keywords
- built-ins
- operators
- attributes
- implicit parameters
- property wrappers
- raw strings
- string interpolation
- generic parameters and arguments
- operator declarations
- precedence groups
These improvements are released in versions 10.5 and 10.6. I've also added a large test suite, to help catch regressions in future versions.
For more information, see the useful links below.
DocC
At WWDC '21, Apple announced Swift-DocC, a new documentation compiler for Swift frameworks and packages. DocC renders its output using Vue.js and relies on Highlight.js for syntax highlighting. I first noticed this on the SwiftUI Tutorials, which are built using DocC but predate its open source release.
Suffice to say, I'm happy to see my work reach so many Swift developers. My contributions made a much bigger impact than I had anticipated, and I feel proud to have indirectly contributed to Swift-DocC and SwiftUI.