Markdown¶
Thanks to Peter Kriens, Alloy supports Markdown syntax. Files written in Alloy Markdown have an .md
extension, just like regular Markdown files. The Alloy Analyzer can read in Markdown files the same way it reads in .als
files.
For an example of an Alloy Markdown file, see Peter Kriens’s Dining Philosophers.
Header¶
A Markdown Alloy file must start with a YAML header: three dashes on the first line, followed by fields and values in YAML format, followed by three more dashes. For example:
--- title: Dining Philosophers ---
Alloy sections¶
After the YAML header, the Alloy parser interprets all text as Markdown. To start an Alloy section, use fenced code blocks with alloy
as the language identifier. For example:
# Literate Programming Let us change our traditional attitude to the construction of programs: Instead of imagining that our main task is to instruct a computer what to do, let us concentrate rather on explaining to human beings **what** we want a computer to do. ```alloy sig Foo {} // this is Alloy syntax ``` If you find that you're spending almost _all_ your time on theory, start turning _some_ attention to practical things; it will improve your theories. If you find that you're spending almost all your time on practice, start turning some attention to theoretical things; it will improve your practice.
GitHub Pages support¶
The YAML header can be used in conjunction with GitHub Pages. GitHub Pages allow you to maintain a website via Github, the YAML header is then used to encode metadata information such as title and layout. This example website shows the dining philosophers example rendered using Jekyll and served from GitHub Pages.