Fountain Movie Script Parser — JavaScript, Python, C#, C++

Ian Thomas
2 min readDec 1, 2024

--

I’ve released the open-source library fountain-tools, parsing utilities for the Fountain movie script format. It’s available in multiple programming languages.

Fountain is a simple plaintext format for movie and TV scripts. It’s also used as an export and import format by multiple script-writing apps, such as Fade In, Highland, Final Draft, Slugline and others.

The Basics

The Fountain.Parser supplied in the tools will take this:

INT. DAVE'S APARTMENT - DAY

Dave is standing in the open window looking out at the pouring rain.

DAVE
(cheerfully)
Nice day for it!

CUT TO:

INT. SPACE STATION - EARTHDAWN #1a#

Jennifer is upside down, looking out through a round porthole of a window, at the sun rising over Earth.

JENNIFER
(bitter)
Nice day for it.

COLIN (O.S.)
Oh no. Not again.

and break it into objects like this:

HEADING: { text: "INT. DAVE'S APARTMENT - DAY" }

ACTION: { text: "Dave is standing in the open window looking out at the pouring rain." }

CHARACTER: { name: "DAVE" }

PARENTHETICAL: { text: "cheerfully" }

DIALOGUE: { text: "Nice day for it!" }

TRANSITION: { text: "CUT TO:" }

HEADING: { text: "INT. SPACE STATION - EARTHDAWN", sceneNumber: "1a"}

ACTION: { text: "Jennifer is upside down, looking out through a round porthole of a window, at the sun rising over Earth." }

CHARACTER: { name: "JENNIFER" }

PARENTHETICAL: { text: "bitter" }

DIALOGUE: { text: "Nice day for it." }

CHARACTER: { name: "COLIN", extension: "O.S." }

DIALOGUE: { text: "Oh no. Not again." }

You can then do what you like with the objects.

An alternative parser, Fountain.CallbackParser, will gather up material and call back using your supplied functions during parsing. In particular, it gathers dialogue lines together with characters, which is often more useful if you want to display dialogue on-screen for some reason.

onSceneHeading: { text: "INT. DAVE'S APARTMENT - DAY" }

onAction: { text: "Dave is standing in the open window looking out at the pouring rain." }

onDialogue: { character: "DAVE", parenthetical: "cheerfully", line: "Nice day for it!" }

onTransition: { text: "CUT TO:" }

onSceneHeading: { text: "INT. SPACE STATION - EARTHDAWN", sceneNumber: "1a"}

onAction: { text: "Jennifer is upside down, looking out through a round porthole of a window, at the sun rising over Earth." }

onDialogue: { character: "JENNIFER" , parenthetical: "bitter", line: "Nice day for it." }

onDialogue: { character: "COLIN", extension: "O.S." line: "Oh no. Not again." }

More Info

Check out the Github Repo. And do let me know if you find a use for any of this, and in particular if you hit any parsing errors!

--

--

Ian Thomas
Ian Thomas

Written by Ian Thomas

Ian is narrative director, coder, and writer of video games, films, larp, books, live events, and VR/AR experiences. Find him on Bluesky or LinkedIn.

No responses yet