karuna/fountain

A PHP parser for Fountain, a simple markup syntax that allows screenplays to be written, edited, and shared in plain, human-readable text.

v1.2.2 2020-11-04 10:38 UTC

This package is auto-updated.

Last update: 2020-11-04 10:43:14 UTC


README

Fountain is a simple markup syntax that allows screenplays to be written, edited, and shared in plain, human-readable text. Fountain allows you to work on your screenplay anywhere, on any computer, using any software that edits text files.

For more details on Fountain see http://fountain.io.

A demo is available on heroku for testing.

Getting started

The simple version for parsing a screenplay text straight into HTML:

    $input = "My fountain input text.";
    $screenplay = new \Fountain\Screenplay();
    $html = $screenplay->parse($input);

The longer version is that Fountain first creates a collection of Elements, which you may use for other purposes. Once the Fountain Elements have been parsed, the FountainTags class determines the correct HTML tags to print.

    $input = "My fountain input text.";
    // determine fountain elements
    $fountainElements = (new \Fountain\FountainParser())->parse($input);
    // parse fountain elements into html
    $html = (new \Fountain\FountainTags())->parse($fountainElements);

Mentions

The code has been built upon the previous work of these contributors.