A CLI tool for creating Typst screenplay projects.
Me. Also anyone that wants to (for whatever dumb reason) write screenplays from neovim.
That's fair. You can find the typst template inside package/, feel free to just copy and paste it yourself. Honestly this is probably the fastest way to get going.
I embed the template into the binary so that the CLI can place it anywhere you want.
git clone [email protected]:ChaseRensberger/typstscript.git
cd typstscript
go build -o typstscriptYou can download the latest binary from the releases section and install/run it however you would like.
You will need to have typst installed. Then,
Create a new screenplay project:
./typstscript init my-scriptThis creates a new directory with:
my-script.typ- Main screenplay file with your titletemplate.typ- Screenplay formatting functionsfonts/- Courier Prime font family
Compile your screenplay:
cd my-script
typst compile --font-path ./fonts my-script.typYou can then start writing your script inside my-script.typ. Syntax looks like:
#action[
He is on his phone, leaving a message for someone.
]
#dialogue_block[
#character("DAVID")
#line[Hey Benji, it's me. I'm just leaving my apartment. Remember we gotta be there three hours early. Just ring me when you get this.]
]
You'll probably want to add some custom snippets to your editor of choice. These are the snippets I use with LuaSnip in my neovim config:
local ls = require("luasnip")
local s = ls.snippet
local t = ls.text_node
local i = ls.insert_node
ls.add_snippets("typst", {
s("a", {
t("#action["),
t({ "", " " }),
i(0, "action"),
t({ "", "]" }),
}),
s("d", {
t("#dialogue_block["),
t({ "", " " }),
i(0),
t({ "", "]" }),
}),
s("s", {
t("#scene(\""),
i(0, "scene"),
t({ "\")" }),
}),
s("l", {
t("#line["),
i(0, "line"),
t({ "]" }),
}),
s("c", {
t("#character(\""),
i(0, "character"),
t({ "\")" }),
}),
s("p", {
t("#parenthetical(\""),
i(0, "parenthetical"),
t({ "\")" }),
}),
s("start", {
t("#import \"template.typ\": *"),
t({ "", "" }),
t({ "", "" }),
t("#show: screenplay.with("),
t({ "", " title: \"" }),
i(0, "title"),
t("\""),
t({ "", ")" }),
}),
})- Scene headings
- Actions
- Dialogue Blocks/Characters/Parentheticals
- Automatic title page generation
- Courier Prime
- US Letter paper format with 1-inch margins
Issues and pull requests are always more than welcome.
