npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

fountainer

v1.0.6

Published

Convert screenplays written using the Fountain syntax into HTML files

Downloads

1

Readme

Fountainer

Fountainer is a Javascript CLI tool to convert screenplays written using Fountain syntax into HTML files.


Contents

Installation

To install the CLI globally run the following command.

npm install fountainer --global

To install the CLI for a specific project, run the following command.

npm install fountainer --save

CLI Usage

The CLI tool can be used as follows.

fountainer -i myStory.fountain -o index.html

The tool accepts the following arguments

| Alias | Name | Description | Default | | -- | -- | -- | -- | | | version | Show version number | | | i | inputFile | complete path to Fountain file | | | n | keepNotes | render notes from the fountain file | false | | g | gitLine | render the draft number by counting the number of commits on the fountain file. This will only work if the file is part of a Git repository | false | | l | lineNumbers | render line numbers corresponding to lines in the fountain file, must be one of "none" - don't print any line numbers, "all" - print all line numbers, "non-empty" - print line numbers only on non-empty lines | "none" | | t | titlePage | render a title page | true | | d | debug | render the inferred class on each line | false | | v | verbose | print verbose logging to console | false | | o | outputFile | complete path to output HTML file (required) | s | stylesPath | path to a custom CSS or SCSS file | <default SCSS> | | p | templatePath | path to a custom template, can be an EJS or HTML file | <default template> | | | showTemplate | print <default template> to console | | | showScss | print <default SCSS> file to console | | w | watch | set this flag to watch inputFile and recompile on change | | | port | applicable only when watch is set, controls the port on which the compiled file will be served when watching | | | help | Show help | |

Javascript API Usage

The tool also exports a javascript library, which can be used as follows.

const fs = require('fs')
const fountainer = require('fountainer')

const parsed = fountainer.parse({ inputFile: 'myStory.fountain' })
const html = fountainer.toHtml(parsed)

fs.writeFileSync('index.html', html)

fountainer.parse(options)

This method parses the input and generates an array of each line of the script.

fountainer.toHtml(parsed, options)

This method generates an HTML string by using the result of the parse function.

options

options for both the functions can have following properties.

{
  inputFile: '',   // path to input file,
  inputString: '', // alternately you can provide the fountain string
  keepNotes: 'inline-notes', // name of class for notes
  gitLine: false,  // applicable only when inputFile is provided,
                   // pulls the git hash and number of commits on the
                   // inputFile and prints it as Draft number
  lineNumbers: 'none', // can be 'none', 'all', 'non-empty' see CLI usage above
  titlePage: true,
  debug: false,
  verbose: false,
  stylesPath: '',  // path to custom CSS/SCSS file
  templatePath: '' // path to custom EJS/HTML file
}

Customizing template and themes

You can start customizing your theme by first copying the default template and theme as follows.

fountainer --showTemplate > template.ejs
fountainer --showScss > styles.scss

Perform all the customization on the template.ejs and styles.scss files as needed, then use your custom template as follows.

fountainer -i story.fountain -p template.ejs -s styles.scss

The template must be an EJS file and will recieve the following object

{
  titlePage, // object containing all the title-page field and value pairs
  lines: [ // an array with the parsed result for each line of the inputFile
    {
      lineNumber, // line number corresponding to input file
      text, // actual text of line 
      name // class name of the line
    }
  ],
  css, // CSS string generated from the --stylesPath
  options // options object provided to the fountainer
}