Welcome to Plot, a domain-specific language (DSL) for writing type-safe HTML, XML and RSS in Swift. It can be used to build websites, documents and feeds, as a templating tool, or as a renderer for higher-level components and tools. It’s primary focus is on static site generation and Swift-based web development. Plot enables you to write HTML using native, fully compiled Swift code, by modeling the HTML5 standard’s various elements as Swift APIs. The result is a very lightweight DSL that lets you build complete web pages in a highly expressive way. Plot added both all of the necessary attributes to load the requested CSS stylesheet, along with additional metadata for the page’s title as well, improving page rendering, social media sharing, and search engine optimization. Attributes can also be applied the exact same way as child elements are added, by simply adding another entry to an element’s comma-separated list of content.
Features
- Type safety built-in
- Plot’s Component protocol enables you to define and render higher-level components using a very SwiftUI-like API
- Just like SwiftUI views, Plot components can pass values downwards through a hierarchy using an environment API
- Inline control flow
- Custom elements and attributes
- Render documents