Architecting a Conversion Engine in Swift
Summary
Minimal's Architecting a Conversion Engine in Swift explains building a conversion engine that uses an Intermediate Representation (IR) to decouple multiple file formats (Markdown, Rich Text, HTML, PDF, MNML). The post argues that an IR reduces the number of relationships between formats from N^2 to linear, citing a bow-tie analogy from biology. It provides the Swift IR data model (Document, Block, Inline, Resource) and outlines parsing and rendering protocols, plus how the engine is integrated into Minimal to enable reliable imports/exports and round-trip fidelity. Practical examples include a proprietary MNML format and tools for bulk export, pasteboard sharing, and Quick Export for sending content to LLMs like Claude or ChatGPT.