Version

The version is 0.1.3 (2020-03-29).

Introduction

This document is the specification for writing a textventure story.

Format

A textventure story is written in YAML.

Schema

On a high-level, a textventure story consists of:

  • id
  • text
  • choice

Story without choice:

<id>: !!str <text>

Story with choice:

<id>: !!map
  <text>: !!seq
    - <choice>: !!str <id>
Property Description
<id> String (unique). Maps to <text>.
<text> String. If a collection, maps to a sequence of <choice>’s.
<choice> String. Maps to <id>.

Config

There’s also an optional _config property:

_config:
  start: start
  renderer: text
Key Value(s) Description
start start (default)
*
String. The start <id>.
renderer text (default)
html
markdown
String. Renderer for <text> and <choice>.

Example

Given the flowchart:

Flowchart of a textventure

The textventure would be written as:

start:
  You come to a fork in the road.:
    - Turn left.: left
    - Turn right.: right

left: You turn left.

right: You turn right.

To add choices to the right node:

right:
  You turn right.:
    - Choice A: choice_a
    - Choice B: choice_b

choice_a: Text for A.

choice_b: Text for B.

To rewrite the textventure in Markdown:

_config:
  renderer: markdown

start:
  ? |- # keeps newlines except for the last one
    You come to a fork in the road.

    ![Image of a fork in the road](fork-in-the-road.jpg)
  : # html entities need to be wrapped in quotes
    - '&larr; Turn _left_.': left
    - '&rarr; Turn _right_.': right

left: You turn left.

right: You turn right.