Javascrip parser and runner for Ficdown.
Go to file
dependabot[bot] 4fc8290f6c
Bump path-parse from 1.0.6 to 1.0.7
Bumps [path-parse](https://github.com/jbgutierrez/path-parse) from 1.0.6 to 1.0.7.
- [Release notes](https://github.com/jbgutierrez/path-parse/releases)
- [Commits](https://github.com/jbgutierrez/path-parse/commits/v1.0.7)

---
updated-dependencies:
- dependency-name: path-parse
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-10 23:52:34 +00:00
src added ability to specify parent element for scrolling 2020-05-10 12:02:17 -05:00
.gitignore starting to rewrite everything in typescript 2019-04-28 02:26:10 -05:00
LICENSE.txt added license 2020-05-11 07:43:54 -05:00
README.md added ability to specify parent element for scrolling 2020-05-10 12:02:17 -05:00
package-lock.json Bump path-parse from 1.0.6 to 1.0.7 2021-08-10 23:52:34 +00:00
package.json added license 2020-05-11 07:43:54 -05:00
test.html updated docs for new typescript changes 2019-04-28 17:52:12 -05:00
tsconfig.json only including needed core-js function 2019-05-16 23:02:27 -05:00

README.md

Ficdown.js

Ficdown is a system for building interactive fiction using MarkDown syntax, and Ficdown.js is a Javascript library for presenting Ficdown stories interactively in a web browser. See Ficdown.com for more information.

Dependencies

The generated ficdown.js and ficdown.min.js include all dependencies (JQuery, markdown-it, and core-js), so no additional scripts are required to play games.

Bulding

You can compile, pack, and minify with these commands:

> npm install
> npm run build
> npm run pack
> npm run minify

You can combine all three build, pack, and minify steps with this command:

> npm run make

Usage

You can obtain ficdown.js or ficdown.min.js from the latest version on the releases page. See the example test.html file for basic usage and styling. The example includes the story content in a hidden text area so it can run locally in a browser.

var player = new Ficdown(playerOptions);
player.play();

Your playerOptions should be an object with the following properties:

  • source: Your story's ficdown code. Either store it right in the html document, or make an XHR to pull the story content in from an external file, and put its content here.
  • id: The id of a div on the page to inject the game into. For example if your html is <div id='game'/> then you would pass game here.
  • scroll (optional): Set this to true if you want the player's full game history to remain on the screen and automatically scroll the page down whenever a new scene is added to the bottom. By default each scene will replace the previous one and the page will be scrolled to the top.
  • scrollParent (optional): The container to scroll. Used even if scroll=false to reset the page position to the top whenever a new scene is displayed. Defaults to the document or body element of the page.
  • html (optional): Set this to true if your ficdown file contains raw html that you want rendered. By default html will not be rendered.
  • startText (optional): Set this to override the link text that begins the game.
  • endMarkdown (optional): Set this to override the "game over" content that is displayed when the player reaches a scene with no more links to follow. Include an anchor with the href set to restart() if you want a link that will start the story over from the beginning.
  • start (optional): Javascript callback function to execute when the user clicks the first link to begin the story.
  • finish (optional): Javascript callback function to execute when the story has finished.