js-fountain
v3.0.1
Published
JS parser for fountain screenplays
Downloads
1
Readme
js-fountain
A maintained fork of Fountain.js.
Roadmap
- [x] Update interface to support fluent calls and plugins
- [ ] Increase unit test code coverage metrics
- [ ] Clean up JS token output
- [ ] New README documentation
- [ ] Project info webpage
Usage
Use #use(html)
to create HTML:
import fountain, { html } from 'js-fountain'
const output = fountain().use(html).parse(fileContents)
// => output.title - 'Big Fish'
// => output.html.title_page - '<h1>Big Fish</h1><p class="author">...'
// => output.html.script - '<h2><span class="bold">FADE IN:</span></h2>...'
Call #parse
without plugins to get an array of tokens:
import fountain from 'js-fountain'
const tokens = fountain().parse(fileContents)
// [
// ...,
// { type="scene_heading", text="EXT. BRICK'S PATIO - DAY", scene_number="1"},
// { type="action", text="A gorgeous day. The su...emplating -- something."},
// { type="action", text="The SCREEN DOOR slides ...es with two cold beers."},
// { type="dialogue_begin"},
// { type="character", text="STEEL"},
// { type="dialogue", text="Beer's ready!"},
// { type="dialogue_end"},
// { type="dialogue_begin"},
// { type="character", text="BRICK"},
// { type="dialogue", text="Are they cold?"},
// ...
// ]
Original README
fountain-js is a JavaScript based parser for the screenplay format Fountain.
You can try fountain-js out. The file system currently uses the HTML 5 File API, which means not all browsers support it, you'll be told if yours doesn't - I'm working on compatiblity. CSS styling isn't complete, so some elements aren't placed correctly and the text spacing might not be quite right, and, as you'll see, individual pages aren't currently supported either.
Syntax Support
As of version 0.1.8 the full Fountain syntax is supported.
Currently fountain-js supports a limited range of key-value pairs for title pages -
- Title, Credit, Author/s, Source, Notes, Draft date, Date, Contact, Copyright
Work is being done to make title page parsing friendlier, allowing custom key-value pairs, but as of version 0.1.0 only the above are supported.