Git Product home page Git Product logo

ficdown.js's Introduction

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.
  • 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.

ficdown.js's People

Contributors

rudism avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.