Topic

Architecture

An overview of how Saga works.

Overview

Saga does its work in multiple stages.

  1. First, it finds all the files within the input folder
  2. Then, for every registered step, it passes those files to a matching Reader. These readers turn text files (such as markdown or reStructuredText files) into Item instances.
  3. Saga runs all the registered steps again, now executing the Writers. These writers turn a rendering context (which holds the Item among other things) into a String using a “renderer”, which it’ll then write to disk, to the output folder.
  4. Finally, all unhandled files (images, CSS, raw HTML, etc.) are copied as-is to the output folder.

Saga does not come with any readers or renderers out of the box. The official recommendation is to use SagaParsleyMarkdownReader for reading markdown files using Parsley, and SagaSwimRenderer to render them using Swim, which offers a great HTML DSL using Swift’s function builders.

Please check the Installation instructions, or check out the Example project to get an idea of how Saga works with Parsley and Swim.