:page_with_curl: textventure/spec
This document is the specification for writing a textventure story.
A textventure story is written in YAML.
On a high-level, a textventure story consists of:
Story without choice:
<id>: !!str <text>
Story with choice:
<id>: !!map
<text>: !!seq
- <choice>: !!str <id>
Property | Description |
---|---|
\ |
String (unique). Maps to \ |
\ |
String. If a collection, maps to a sequence of \ |
\ |
String. Maps to \ |
There’s also an optional _config
property:
_config:
start: start
renderer: text
Key | Value(s) | Description |
---|---|---|
start | start (default) * |
String. The start \ |
renderer | text (default) html markdown |
String. Renderer for \ |
Given the flowchart:
!-- https://gist.github.com/remarkablemark/30d3974972e6fc3348fe3c58136e5aaa --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.

: # html entities need to be wrapped in quotes
- '← Turn _left_.': left
- '→ Turn _right_.': right
left: You turn left.
right: You turn right.