finds.dev

JohnSundell/Splash

A fast, lightweight and flexible Swift syntax highlighter for blogs, tools and fun!

View on GitHub

★ 1,869SwiftMITupdated May 2024

// the take

Splash is a Swift-only syntax highlighter built by John Sundell, the person behind swiftbysundell.com. It parses Swift source into tokens using a hand-written grammar and outputs HTML, NSAttributedString, or images. If you're building a Swift blog engine or developer tool on macOS/Linux and need Swift highlighting without pulling in a heavy dependency, this is a good fit.

The output format is a protocol, so swapping HTML for a custom renderer is a ten-line change. The tokenizer exposes raw segment data, which means you can build tooling on top of it rather than just pretty-printing. The test suite is thorough — there are dedicated files for closures, enums, optionals, preprocessor directives, and more, which matters a lot for a language with Swift's syntactic variety. It's pure Swift with no dependencies, so it compiles cleanly on Linux for server-side use.

It only handles Swift. If your project mixes Swift with YAML configs, shell scripts, or JSON examples, you're on your own or reaching for a different library. The grammar is hand-written rule matching, not a proper parser, so edge cases in newer Swift syntax (macros, parameter packs) will break silently or produce wrong token types — and the last push was May 2024, so Swift 5.9/6 features are likely partially broken. SplashImageGen is macOS-only, which is fine but underdocumented in the README. There's no published API reference; you're reading source to understand the token model.

We read the README, the directory tree and a key source file in July 2026. Nobody pays to be listed. How we judge →

// at a glance

Stars
1,869
Forks
147
Language
Swift
License
MIT
Last commit
27 May 2024

// nearby

If Splash isn't quite it.

All repos →