Self-generative poem engine
- Write a markdown file, for example
my_poem.md
- Lines starting with `#` are ignored
- All lines before ```js are considered to be the poem
- All lines in the js code block are the script part
- You must define a state with
poem.__state__ = {}
- You may define multiple functions to act on your poems as such:
- Assign lambdas to
poem.valid_identifier
orpoem["a_non_spaced_string"]
- They must accept an object with these keys:
tokens
,position
andstate
- They must return an object with these same keys
- Assign lambdas to
- All code in script is evaluated with
eval()
and so must be valid js - Run the script with
node poemd.js [-o|-w] my_poem.md
:-o
outputs the resulting poem-w
writes the resulting poem to the markdown file at the bottom of it