Swim::Design

This document describes the Swim markup format, its goals and its specific design decisions.

Swim Goals

  • Beautiful input syntax and beautiful output renderings

  • (re)Use the best existing markup syntaxes

  • Render to many formats

    • HTML

    • Plain text

    • Other common text markups (Markdown, Pod, etc)

  • Core info model supports most common, useful constructs

  • Support everything else via pluggable extension syntax

The Swim Informational Model

Swim defines an information model for text documents. The 2 main generic components are blocks and phrases. This pretty directly corresponds to the HTML concepts of divs and spans.

The model is roughly expressed by this grammar:

# A document is a set of blocks
document: block*
# A block is /either/ a set of more blocks /or/ a set of phrases
block: block* | phrase*
# A phrase is moer or less a sentence fragement
phrase: bold | italic | link | … | plain-text

Swim is literally defined by this grammar: