Skip to content

notnullgames/mdif

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Markdown Interactive Fiction

This is a dialog/interactive fiction engine (for javascript) that lets you describe conversations and games. It uses a subset of markdown to define your dialogs.

usage

In your own project:

npm i mdif
import { promises as fs } from 'fs'
import createDialog from 'mdif'

const md = await fs.readFile('example.md')

// read some info
console.log(md)

// set callbacks
md.onChoice = choice => {
  console.log('CHOICE', choice)
}
md.onClose = () => {
  console.log('CLOSE')
}
md.onLine = line => {
  console.log('LINE', line)
}
md.onChoices = choices => {
  console.log('CHOICES', choices)
}

// get the first line of dialog from "start"
dialog.open('start')

console.log(dialog.current)

try it out here

git clone https://github.com/konsumer/mdif.git
cd mdif

npm i          # install deps & tools

npm run cli    # run examples/cli demo
npm run raylib # run examples/raylib demo
npm test       # run unit-tests in mdif.test.js, that also have some usage info

About

(nodejs) dialog/interactive fiction engine that lets you use markdown to describe conversations and games

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors