TwineJson - Twine 2 JSON Exporter Utility Story Format
Short version:
Add this URL as your story format
Long version:
Step 1 - At the main screen, click on Formats
Step 2 - Select the tab Add new Format, then paste the URL (https://cau.li/TwineJson/format.js)
Step 3 (Optional) - Back to the Story Formats tabs, favorite TwineJson to default it
Step 5 - Confirm that TwineJson is selected
Step 6 - Press Play to export your Json file
$ npm install --global gulp-cli #install gulp if you don't have already
$ npm install #installs all dependencies specified on package.json
$ mocha #to run test cases
$ gulp
Your file format will be created on the ./dist/format.js
folder.
TwineJson exports Twine2 projects to JSON, adding information that goes beyond plaintext data.
You can, for instance, generate hierarchical JSONs that contains the information of ancestors of each passage.
It is possible to add custom properties of each passage to the JSON by using TwineJson's {{propertyKey}}Value{{/propertyKey}} syntax
Title: Passage Father
{{hierarchy}}
father
{{/hierarchy}}
Will be built as:
{
"id": "1",
"name": "Passage Father",
"content": "{{hierarchy}} father {{/hierarchy}}",
"hierarchy": "father",
}
A Father->Child relationship will be exported as follows:
{
"id": "1",
"name": "Passage Father",
"content": "{{hierarchy}} father {{/hierarchy}} [[Passage Child]]",
"childrenNames": "[[Passage Child]]",
"hierarchy": "father",
"children": [
{
"id": "2",
"name": "Passage Child",
"content": "{{hierarchy}} child {{/hierarchy}}",
"childrenNames": "",
"hierarchy": "child",
"children": []
}
]
}