finds.dev← search

// the find

JohnSundell/Plot

★ 2,028 · Swift · MIT · updated Jul 2024

A DSL for writing type-safe HTML, XML and RSS in Swift.

Plot is a Swift DSL for generating HTML, XML, and RSS documents with compile-time type safety enforced via phantom types and generic constraints. It's primarily a building block for Swift static site generators, most notably Sundell's own Publish. If you're building a static site generator or content pipeline in Swift, this is the most mature option in that niche.

The phantom types approach is genuinely clever — you get compiler errors for invalid HTML structure (putting a `<p>` inside a `<ul>`) rather than discovering broken markup at runtime. The Component API mirrors SwiftUI closely enough that iOS/macOS developers will feel at home immediately, including `@EnvironmentValue` propagation down the tree. RSS, podcast feeds, and sitemaps are first-class citizens with the same type safety as HTML, not bolted-on afterthoughts. The test suite is thorough and the rendering code prioritizes performance with minimal string copying.

Still at 0.x versioning after years of existence, which means breaking API changes are possible without ceremony — the README even warns against beta software but the library itself has no stable release commitment. The Component API can only express `<body>` content; anything in `<head>` forces you back to the Node-based API, creating an awkward two-tier system in practice. No issues or direct support means when you hit a missing HTML attribute (and you will), your only option is a PR or a local workaround. Last meaningful activity was mid-2024 and the project appears to be in maintenance-only mode, which matters if you need it to track new HTML5 specs.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →